Authored by 李奇

检索页新增最近检索逻辑

... ... @@ -163,12 +163,24 @@ Page({
this.productList(params);
},
searchRecent: function() {
searchRecent: function(e) {
const key = e.target.dataset.key;
this.confirmQuery({
detail: {
value: key
}
});
},
deleteRecent: function() {
wx.setStorage({
key: 'search_hot_keys',
data: []
});
this.setData({
recentKeys: []
});
},
setRecentKeys: function(key) {
... ...
... ... @@ -10,7 +10,8 @@
<view class="title">最近搜索
<image class="delete" src="../../../static/images/delete.png" bindtap="deleteRecent"></image></view>
<view class="keys">
<text wx:for="{{recentKeys}}" wx:key="{{item}}" class="key" bindtap="searchRecent">{{item}}</text>
<text wx:for="{{recentKeys}}" wx:key="{{item}}"
class="key" bindtap="searchRecent" data-key="{{item}}">{{item}}</text>
</view>
</view>
<view hidden="{{!searched}}">
... ...