diff --git a/buyer/src/components/Search.vue b/buyer/src/components/Search.vue index e5843007..5e9dcfdd 100644 --- a/buyer/src/components/Search.vue +++ b/buyer/src/components/Search.vue @@ -22,7 +22,11 @@ @@ -66,9 +71,15 @@ export default { default:'' } }, + watch:{ + storeId(val){ + this.onlyStore = val ? true : false + } + }, data() { return { - searchData: '' // 搜索内容 + searchData: '', // 搜索内容 + onlyStore:false, }; }, methods: { @@ -76,6 +87,9 @@ export default { this.searchData = item; this.search(); }, + research(){ + this.onlyStore = !this.onlyStore + }, search () { // 全平台搜索商品 const url = this.$route.path; if(url == '/goodsList'){ @@ -85,7 +99,7 @@ export default { path:'/goodsList', query: { keyword: this.searchData }, } - if(this.storeId) pushData.query.storeId = this.storeId + if(this.storeId && this.onlyStore) pushData.query.storeId = this.storeId this.$router.push(pushData); @@ -106,6 +120,7 @@ export default { }, created() { this.searchData = this.$route.query.keyword + if (!this.hover) { // 首页顶部固定搜索栏不调用热词接口 // 搜索热词每5分钟请求一次 const reloadTime = storage.getItem('hotWordsReloadTime') @@ -126,6 +141,11 @@ export default { };