a1300399510@qq.com 提交于 2023/04/06 -16:20:01
This commit is contained in:
parent
44554dfceb
commit
305fe7a016
@ -86,6 +86,8 @@ export default {
|
||||
mounted() {
|
||||
this.kw = this.$route.query.kw
|
||||
this.getSearchResult()
|
||||
console.log(this.historicalSearch, "historicalSearch");
|
||||
|
||||
},
|
||||
|
||||
watch: {
|
||||
@ -96,10 +98,13 @@ export default {
|
||||
|
||||
historicalSearch(val, oldval) {
|
||||
console.log("val", val);
|
||||
if (val.length > 10) this.historicalSearch = val.slice(0, 10)
|
||||
else this.$store.commit('setHistoricalSearch', val)
|
||||
// if (val.length > 10) {
|
||||
// this.historicalSearch = val.slice(0, 10)
|
||||
// }
|
||||
// else this.$store.commit('setHistoricalSearch', this.historicalSearch)
|
||||
|
||||
// this.$store.commit('setHistoricalSearch', val)
|
||||
|
||||
return val
|
||||
},
|
||||
},
|
||||
|
||||
@ -113,9 +118,11 @@ export default {
|
||||
// 处理搜索框回车
|
||||
handleSearchResult() {
|
||||
let kw = this.kw
|
||||
// this.historicalSearch.push(kw)
|
||||
console.log("this.historicalSearch", this.historicalSearch);
|
||||
if (!kw) return
|
||||
// console.log(this.historicalSearch.includes(kw), "this.historicalSearch.includes(kw)");
|
||||
console.log(this.historicalSearch.unshift(kw));
|
||||
if (!this.historicalSearch.includes(kw)) this.historicalSearch = this.historicalSearch.unshift(kw)
|
||||
console.log(this.historicalSearch, "historicalSearch");
|
||||
|
||||
this.getSearchResult()
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user