Merge branch 'feature/task1.0.0_xg' into 'feature/task1.0.0'

feat: 添加购物车/删除购物车商品时,更新购物车面板

See merge request yanxuan-frontend/shop-pc!48
merge-requests/49/head
肖广 2 years ago
commit 8265d096d9

@ -22,7 +22,7 @@
<div
v-for="item in products"
:key="item.id"
@click="onJumpGoodsDetail"
@click="onJumpGoodsDetail(item.product.id)"
class="header-cart-products__wrap flex flex-middle flex-between"
>
<div class="cart-products-wrap__left flex felx-middle">
@ -51,7 +51,7 @@
<div
v-for="item in failureProducts"
:key="item.id"
@click="onJumpGoodsDetail"
@click="onJumpGoodsDetail(item.product.id)"
class="header-cart-products__wrap flex flex-middle flex-between"
>
<div class="cart-products-wrap__left flex felx-middle">
@ -108,6 +108,16 @@ export default {
},
},
watch: {
token: {
immediate: true,
handler(val) {
if (val) {
this.$store.dispatch("getCartProducts");
return;
}
this.$store.commit("setCartProducts", []);
},
},
cartProducts: {
immediate: true,
deep: true,
@ -129,11 +139,6 @@ export default {
},
},
},
created() {
if (this.token) {
this.$store.dispatch("getCartProducts");
}
},
methods: {
onJumpCart() {
if (!this.$isLoginValidate()) {

@ -223,6 +223,7 @@ export default {
}else{
this.checkedIds = [];
}
this.$store.dispatch('getCartProducts');
})
},

@ -454,6 +454,7 @@ export default {
return false;
}
this.$message.success("加入购物车成功~");
this.$store.dispatch('getCartProducts');
// this.$Router.push('/cart');
},
},

Loading…
Cancel
Save