如何解决Vuex与PayPal
有人将Paypal与Vue和Vuex集成到他们的项目中吗?我不知道如何使用Vuex更改Paypal上的金额。有许多不同的产品,价格不同。不幸的是,这似乎很轻松,但是贝宝却不想运行。我已经尝试了一切,并一直在寻找其他帖子的想法,但是没有任何效果:/
请帮我一些想法!谢谢!!
贝宝(Paypal)按钮的代码:
createOrder: function(data,actions) {
// This function sets up the details of the transaction,including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
value: '0.01'
}
}]
});
},store.js
export default new Vuex.Store({
Vuex.
state: {
forSale: [
{
invId: 1,name: 'XY',price: 120,image: A
},{
invId: 2,name: 'XYZ',price: 130,image: M
},shopping cart
name: 'shoppingCart',computed: {
inCart() { return this.$store.getters.inCart; },numInCart() { return this.inCart.length; },cart() {
return this.$store.getters.inCart.map((cartItem) => {
return this.$store.getters.forSale.find((forSaleItem) => {
return cartItem === forSaleItem.invId;
});
});
},total() {
return this.cart.reduce((acc,cur) => acc + cur.price,0);
},},filters: {
dollars,methods: {
removeFromCart(index) { this.$store.dispatch('removeFromCart',index); },}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。