From 2df4d6f286e45f1d64647c446df75b26f3d88b83 Mon Sep 17 00:00:00 2001 From: modendeveloper Date: Sat, 1 Mar 2025 16:54:33 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A3284=20=E3=80=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E6=90=9C=E7=B4=A2=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E2=80=94=E7=BC=96=E8=BE=91=E6=90=9C=E7=B4=A2=E6=A1=86?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=97=B6=EF=BC=8C=E6=B5=AE=E5=8A=A8=E8=AF=8D?= =?UTF-8?q?=E6=9D=A1=E6=B2=A1=E6=9C=89=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/shop/GoodSearch/index.vue | 38 +++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/pages/shop/GoodSearch/index.vue b/pages/shop/GoodSearch/index.vue index 29ce2bb..dec129c 100644 --- a/pages/shop/GoodSearch/index.vue +++ b/pages/shop/GoodSearch/index.vue @@ -14,10 +14,10 @@ @change="hideHistory" @compositionstart="hideHistory" /> - + @@ -145,11 +145,21 @@ export default { this.getCartCount() }, onLoad(opts){ - this.keywords1 = opts.keywords + this.search = opts.keywords }, onShow() { this.getHistory() }, + watch: { + search(val) { + if(val) { + this.showkey = false + } else { + this.showkey = true + this.currentSearch = this.recommendKeyword[0] + } + } + }, methods: { // 获取购物车数量 getCartCount () { @@ -166,6 +176,7 @@ export default { this.$yrouter.switchTab('/pages/cart') }, showHistory() { + if(this.showkey) return if(this.search) { this.showkey = false return @@ -174,10 +185,10 @@ export default { }, hideHistory() { - // if(!this.search) { - // this.showkey = true - // return - // } + if(!this.search) { + this.showkey = true + return + } this.showkey = false }, change(e) { @@ -186,17 +197,15 @@ export default { submit() { if (this.showkey) { const search = trim(this.currentSearch) || '' - console.log(search); - if (!search) return this.setHistory(search) - this.search = '' + // this.search = '' this.toSearch(search) } else { const search = trim(this.search) || '' if (!search) return this.setHistory(search) - this.search = '' + // this.search = '' this.toSearch(search) } @@ -213,8 +222,8 @@ export default { this.rankingArr.push(data.ranking1) this.rankingArr.push(data.ranking2) this.recommendKeyword = data.recommendKeyword.split(',') - const index = this.recommendKeyword.indexOf(this.keywords1) - [this.recommendKeyword[0], this.recommendKeyword[index]] = [this.recommendKeyword[index], this.recommendKeyword[0]]; + // const index = this.recommendKeyword.indexOf(this.keywords1) + // [this.recommendKeyword[0], this.recommendKeyword[index]] = [this.recommendKeyword[index], this.recommendKeyword[0]]; } }) }, @@ -311,7 +320,8 @@ export default { border-radius: 28rpx; color: #fff; font-weight: bold; - + padding: 0; + font-size: 26rpx; .icon-sousuo2 { margin-right: 4rpx; font-size: 28rpx;