This commit is contained in:
xiaozhiyong
2023-03-28 11:23:06 +08:00
parent 0aba2c9769
commit a69e3bdbb7

View File

@@ -191,6 +191,15 @@
this.user = uni.getStorageSync('user');
},
collectionFn(item) {
let collectHas3 = this.collection.every(i => i !== '')
if(collectHas3) {
uni.showToast({
title: '只可以收藏3个哦~',
icon: 'none'
})
return
}
let isHave = this.collection.find(i => i.name === item.name)
// 是否已收藏
if(isHave) {
@@ -203,10 +212,10 @@
this.$set(this.collection,isHaveEmptyIndex,item)
return
}
//如果收藏满了 栈底推出
this.collection.pop()
//栈顶推入
this.collection.unshift(item)
// //如果收藏满了 栈底推出
// this.collection.pop()
// //栈顶推入
// this.collection.unshift(item)
},
gestureAnalysis(e) {},
indexDis(e) {