|
|
@@ -93,13 +93,20 @@ Page({
|
|
|
key.id = this.data.searchKey.length;
|
|
|
key.searchVal = this.data.searchVal;
|
|
|
|
|
|
- let searchKey = this.data.searchKey
|
|
|
- searchKey.push(key);
|
|
|
- wx.setStorageSync("searchKey", searchKey);
|
|
|
+ let searchKey = this.data.searchKey
|
|
|
+ if (!searchKey.map(value => value.searchVal).includes(this.data.searchVal)) {
|
|
|
+ searchKey.push(key);
|
|
|
+ wx.setStorageSync("searchKey", searchKey);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- wx.navigateTo({
|
|
|
- url: '../search-result/search-result?searchVal=' + this.data.searchVal,
|
|
|
- })
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '../search-result/search-result?searchVal=' + this.data.searchVal,
|
|
|
+ success: () => {
|
|
|
+ this.setData({
|
|
|
+ searchVal: ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
})
|