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() {
|
mounted() {
|
||||||
this.kw = this.$route.query.kw
|
this.kw = this.$route.query.kw
|
||||||
this.getSearchResult()
|
this.getSearchResult()
|
||||||
|
console.log(this.historicalSearch, "historicalSearch");
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
@ -96,10 +98,13 @@ export default {
|
|||||||
|
|
||||||
historicalSearch(val, oldval) {
|
historicalSearch(val, oldval) {
|
||||||
console.log("val", val);
|
console.log("val", val);
|
||||||
if (val.length > 10) this.historicalSearch = val.slice(0, 10)
|
// if (val.length > 10) {
|
||||||
else this.$store.commit('setHistoricalSearch', val)
|
// 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() {
|
handleSearchResult() {
|
||||||
let kw = this.kw
|
let kw = this.kw
|
||||||
// this.historicalSearch.push(kw)
|
if (!kw) return
|
||||||
console.log("this.historicalSearch", this.historicalSearch);
|
// 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)
|
if (!this.historicalSearch.includes(kw)) this.historicalSearch = this.historicalSearch.unshift(kw)
|
||||||
|
console.log(this.historicalSearch, "historicalSearch");
|
||||||
|
|
||||||
this.getSearchResult()
|
this.getSearchResult()
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user