Commit fc3886ff authored by Junling Bu's avatar Junling Bu
Browse files

fix[litemall-vue]: 收藏功能修复

parent 868764c8
...@@ -148,12 +148,17 @@ computed: { ...@@ -148,12 +148,17 @@ computed: {
}, },
addCollect() { addCollect() {
collectAddOrDelete({valueId: this.itemId, type: 0}).then(res => { collectAddOrDelete({valueId: this.itemId, type: 0}).then(res => {
let type = res.data.data.type; if(this.goods.userHasCollect === 1){
this.goods.userHasCollect = type === 'add' ? 1 : 0; this.goods.userHasCollect = 0
this.$toast({ }
message: type === 'add' ? '添加成功' : '取消成功', else{
duration: 1500 this.goods.userHasCollect = 1
}); this.$toast({
message: '收藏成功',
duration: 1500
});
}
}); });
}, },
getProductId(s1, s2) { getProductId(s1, s2) {
......
...@@ -60,8 +60,10 @@ export default { ...@@ -60,8 +60,10 @@ export default {
methods: { methods: {
init() { init() {
collectList({type:0, page:this.page, limit:this.limit}).then(res => { collectList({type:0, page:this.page, limit:this.limit}).then(res => {
const { collectList, page } = res.data.data; this.page = res.data.data.page;
this.items.push(...collectList); this.limit = res.data.data.limit;
this.total = res.data.data.total;
this.items.push(...res.data.data.list);
}); });
}, },
cancelCollect(event, i, item) { cancelCollect(event, i, item) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment