Authored by 陈轩

响应 app 刷新购物车的事件

... ... @@ -23,7 +23,7 @@
};
},
methods: {
selectItem(item) {
selectItem() {
this.hide();
return true;
},
... ... @@ -49,7 +49,6 @@
z-index: 2010;
overflow: auto;
&.filter-sub-open {
transform: translate3d(0, 0, 0);
}
... ... @@ -85,6 +84,10 @@
padding: 0 $w;
height: 100px;
line-height: 100px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
</style>
\ No newline at end of file
... ...
... ... @@ -409,6 +409,7 @@
const tip = require('common/tip');
const yoho = require('yoho');
const share = require('common/share');
const bus = require('common/vue-bus');
require('vue-swipe/dist/vue-swipe.css');
... ... @@ -498,6 +499,17 @@
});
}
});
},
/*
刷新购物车
*/
refreshCart: function() {
$.get('/product/cart-count.json').then(result=> {
if (result.code === 200) {
this.cartCount = result.data.cart_goods_count;
}
});
}
},
created() {
... ... @@ -555,11 +567,8 @@
// 读取购物车数量
if (this.isApp) {
$.get('/product/cart-count.json').then(result=> {
if (result.code === 200) {
this.cartCount = result.data.cart_goods_count;
}
});
this.refreshCart();
bus.on('app.shoppingcart,refresh', () => this.refreshCart);
}
}
};
... ...