|
@@ -99,19 +99,20 @@ Page({
|
|
|
})
|
|
|
if (!this.data.historySearch.includes(this.data.text)) {
|
|
|
this.setData({
|
|
|
- historySearch: [...this.data.historySearch, this.data.text]
|
|
|
+ historySearch: [...this.data.historySearch, this.data.text].slice(-10)
|
|
|
})
|
|
|
}
|
|
|
this.setData({
|
|
|
list,
|
|
|
+ nullList: list.length == 0
|
|
|
})
|
|
|
- wx.setStorageSync('search', this.data.historySearch)
|
|
|
+ wx.setStorageSync('search', this.data.historySearch.slice(-10))
|
|
|
},
|
|
|
historySearch({
|
|
|
currentTarget
|
|
|
}) {
|
|
|
this.setData({
|
|
|
- text: currentTarget.dataset.text
|
|
|
+ text: currentTarget.dataset.text,
|
|
|
})
|
|
|
this.search()
|
|
|
},
|
|
@@ -122,9 +123,9 @@ Page({
|
|
|
return item != currentTarget.dataset.text
|
|
|
})
|
|
|
this.setData({
|
|
|
- historySearch: newList
|
|
|
+ historySearch: newList.slice(-10)
|
|
|
})
|
|
|
- wx.setStorageSync('search', newList)
|
|
|
+ wx.setStorageSync('search', newList.slice(-10))
|
|
|
},
|
|
|
goRead({
|
|
|
currentTarget
|