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

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

parent 868764c8
......@@ -148,12 +148,17 @@ computed: {
},
addCollect() {
collectAddOrDelete({valueId: this.itemId, type: 0}).then(res => {
let type = res.data.data.type;
this.goods.userHasCollect = type === 'add' ? 1 : 0;
this.$toast({
message: type === 'add' ? '添加成功' : '取消成功',
duration: 1500
});
if(this.goods.userHasCollect === 1){
this.goods.userHasCollect = 0
}
else{
this.goods.userHasCollect = 1
this.$toast({
message: '收藏成功',
duration: 1500
});
}
});
},
getProductId(s1, s2) {
......
......@@ -60,8 +60,10 @@ export default {
methods: {
init() {
collectList({type:0, page:this.page, limit:this.limit}).then(res => {
const { collectList, page } = res.data.data;
this.items.push(...collectList);
this.page = res.data.data.page;
this.limit = res.data.data.limit;
this.total = res.data.data.total;
this.items.push(...res.data.data.list);
});
},
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