Fix:3246 【商城小程序】点击浮动关键词进入搜索页面,搜索框未固定显示该关键词

This commit is contained in:
linxi
2025-02-24 18:06:49 +08:00
parent 910991ad69
commit 744e6d98f9
2 changed files with 23 additions and 4 deletions
+16 -3
View File
@@ -23,7 +23,16 @@
/>
</view>
<view class="swpier-bar">
<u-notice-bar duration="4000" :text="recommendKeyword" :icon="' '" color="#333" fontSize="12" bgColor="transparent" direction="column"></u-notice-bar>
<u-notice-bar
duration="4000"
:text="recommendKeyword"
:icon="' '"
color="#333"
fontSize="12"
bgColor="transparent"
@change="changeRecommendKeyword"
direction="column">
</u-notice-bar>
</view>
</view>
</view>
@@ -418,7 +427,8 @@ export default {
isPlay: true,
tabIconPostion: {},
messageIcon: {},
recommendKeyword: []
recommendKeyword: [],
keywordIndex: 0
}
},
onLoad() {
@@ -454,6 +464,9 @@ export default {
this.scrollTop = e.scrollTop
},
methods: {
changeRecommendKeyword(e) {
this.keywordIndex = e
},
getSearch() {
getSearchPageConfig().then(res => {
const { success, data } = res
@@ -1376,7 +1389,7 @@ export default {
}
},
goGoodSearch() {
this.$yrouter.push('/pages/shop/GoodSearch/index')
this.$yrouter.push('/pages/shop/GoodSearch/index?keywords=' + this.recommendKeyword[this.keywordIndex] )
},
goGoodsCon(item) {
if(item.isFarmerShop) {
+7 -1
View File
@@ -133,7 +133,8 @@ export default {
historyKey: [],
rankingArr: [],
recommendKeyword: [],
CartCount: 0
CartCount: 0,
keywords1: ''
}
},
computed: mapGetters(['isLogin', 'location', 'userInfo']),
@@ -141,6 +142,9 @@ export default {
this.getData()
this.getCartCount()
},
onLoad(opts){
this.keywords1 = opts.keywords
},
onShow() {
this.getHistory()
},
@@ -206,6 +210,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]];
}
})
},