a1300399510@qq.com 提交于 2023/04/06 -12:20:01

This commit is contained in:
2023-04-06 12:20:11 +08:00
parent b130ba67d3
commit d7807870c5
2 changed files with 26 additions and 8 deletions

View File

@@ -18,19 +18,18 @@
<div class="search-close" @click="searchClose()">取消</div>
</div>
<!-- 历史搜索 -->
<div class="search-content flexcolumn">
<div class="search-content flexcolumn" v-if="historicalSearch.length != 0">
<div class="search-text">历史搜索</div>
<div class="search-label">
<span>香港大学</span>
<span>香港大学</span>
<span>香港大学</span>
<span v-for="(item, index) in historicalSearch" :key="index">香港大学</span>
</div>
</div>
<!-- 热门搜索 -->
<div class="search-content">
<div class="search-text">热门搜索</div>
<div class="search-label">
<span v-for="(item, index) in hotSearchkeywords" :key="index" @click="toSearchResult(item)">{{ item }}</span>
<span v-for="(item, index) in hotSearchkeywords" :key="index" @click="toSearchResult(item)">{{ item
}}</span>
</div>
</div>
</div>
@@ -45,10 +44,18 @@ export default {
searchWinShow: false,//显示搜索弹窗
searchText: '',
showClear: false, //显示清除按钮
historicalSearch: [], // 历史搜索
}
},
props: ["issearch", "hotSearchkeywords"],
mounted() {
let hotSearchkeywords = ["香港大学","香港大学"]
var cachedData = localStorage.setItem('hotSearchkeywords',[]) || [];
// var cachedData = localStorage.getItem('hotSearchkeywords') || [];
},
methods: {
collapseClick() {
if (this.collapseShow == true) this.collapseShow = false;
@@ -75,7 +82,7 @@ export default {
},
// 跳转搜索结果
toSearchResult(kw){
toSearchResult(kw) {
this.$router.push(`/searchResult?kw=${kw}`)
},
},