a1300399510@qq.com 提交于 2023/04/03 -14:20:01

This commit is contained in:
2023-04-03 14:20:10 +08:00
parent 895d5546f7
commit f16695ec50
4 changed files with 17 additions and 278 deletions

View File

@@ -10,7 +10,7 @@
</div>
<div class="right flexacenter">
<search-box slot="search" :issearch="issearch"></search-box>
<search-box slot="search" :hot-searchkeywords="hotSearchkeywords" :issearch="issearch"></search-box>
<div class="head-more flexcenter" @click="headMorePopState = !headMorePopState">
<div class="red-dot" v-if="false"></div>
@@ -119,11 +119,9 @@ export default {
this.$http.post("/api/index",).then((res) => {
if (res.code != 200) return;
// this.prototype.userInfo = res.data.user
// this.userInfo = res.data.user;
this.userInfo = res.data.user;
this.islogin = res.data.user.uid > 0 ? true : false;
this.hotSearchkeywords = res.data.hotSearchkeywords
this.prototype.userInfo = res.data.user
console.log(this.prototype.userInfo, "userInfo");
}).catch(err => {
this.$message.error(err.message)

View File

@@ -30,9 +30,7 @@
<div class="search-content">
<div class="search-text">热门搜索</div>
<div class="search-label">
<span>Bocconi</span>
<span>Bocconi</span>
<span>Bocconi</span>
<span v-for="(item, index) in hotSearchkeywords" :key="index" @click="toSearchResult(item)">{{ item }}</span>
</div>
</div>
</div>
@@ -49,7 +47,7 @@ export default {
showClear: false, //显示清除按钮
}
},
props: ["issearch"],
props: ["issearch", "hotSearchkeywords"],
methods: {
collapseClick() {
@@ -74,7 +72,12 @@ export default {
// 清空文本框
clearText() {
this.searchText = ""
}
},
// 跳转搜索结果
toSearchResult(kw){
this.$router.push(`/searchResult?kw=${kw}`)
},
},
mounted() {
if (this.searchText.length > 0) this.showClear = true