|
@@ -104,7 +104,7 @@ Page({
|
|
|
})
|
|
|
if (!this.data.historySearch.includes(this.data.text)) {
|
|
|
this.setData({
|
|
|
- historySearch: [this.data.text, ...this.data.historySearch].slice(0, 10)
|
|
|
+ historySearch: [this.data.text, ...this.data.historySearch].slice(0, 20)
|
|
|
})
|
|
|
wx.setStorageSync('search', this.data.historySearch)
|
|
|
}
|
|
@@ -128,10 +128,24 @@ Page({
|
|
|
return item != currentTarget.dataset.text
|
|
|
})
|
|
|
this.setData({
|
|
|
- historySearch: newList.slice(0, 10)
|
|
|
+ historySearch: newList.slice(0, 20)
|
|
|
})
|
|
|
wx.setStorageSync('search', this.data.historySearch)
|
|
|
},
|
|
|
+ clearHistory() {
|
|
|
+ wx.showModal({
|
|
|
+ title: '温馨提示',
|
|
|
+ content: '历史记录清除后无法恢复,是否清除全部记录',
|
|
|
+ success: (res) => {
|
|
|
+ if (res.confirm) {
|
|
|
+ this.setData({
|
|
|
+ historySearch: []
|
|
|
+ })
|
|
|
+ wx.setStorageSync('search', this.data.historySearch)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
goRead({
|
|
|
currentTarget
|
|
|
}) {
|