|
@@ -26,6 +26,10 @@ export default defineComponent({
|
|
|
defaultRadio: {
|
|
|
type: Number,
|
|
|
default: 0
|
|
|
+ },
|
|
|
+ onOpenWebView: {
|
|
|
+ type: Function,
|
|
|
+ default: (n: any) => {}
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
@@ -96,7 +100,7 @@ export default defineComponent({
|
|
|
price: selectItem.price, //添加到购物车的价格
|
|
|
productSkuId: selectItem.id,
|
|
|
quantity: this.total, // 数量
|
|
|
- productId: item.id,
|
|
|
+ productId: item.id
|
|
|
}
|
|
|
// console.log(body)
|
|
|
try {
|
|
@@ -112,10 +116,15 @@ export default defineComponent({
|
|
|
confirmButtonColor: 'var(--van-primary)'
|
|
|
})
|
|
|
.then(() => {
|
|
|
+ // 如果为首页加入购物车跳转, 使用首页的公用跳转方法
|
|
|
+ if (this.onOpenWebView.toString() === 'n => {}') {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/cart'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.onOpenWebView('/cart')
|
|
|
+ }
|
|
|
// on confirm
|
|
|
- this.$router.push({
|
|
|
- path: '/cart'
|
|
|
- })
|
|
|
})
|
|
|
.catch(() => {
|
|
|
// on cancel
|