From a69e3bdbb7000cde391f9a9b9e310d3432124764 Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Tue, 28 Mar 2023 11:23:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/newindex.vue | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pages/index/newindex.vue b/pages/index/newindex.vue index 3660232..69e44e5 100644 --- a/pages/index/newindex.vue +++ b/pages/index/newindex.vue @@ -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) {