微信小程序获取本地缓存的搜索记录
html
<!--index.wxml-->
//这里是搜索框
<view class="box_search">
<image src="/images/ic_search.png" class="ic_search"></image>
<input type="text" value="{
{keywords}}" bindinput="get_keyword" placeholder="搜索店铺名或商品名" bindconfirm="getInputValue" placeholderStyle="color: #999" data-input="values" bindblur="get_search"></input>
<image src="/images/ic_close.png" class="ic_clear" wx:if="{
{keywords}}" bindtap="toClear"></image>
</view>
//这里显示搜索记录
<block wx:else >
<view class="hotbox">
<view class="text">搜索历史:</view>
<view class="oldsearch">
<view wx:for="{
{ history }}" wx:key="*this">
<!-- <navigator class="label" url="/store/search_store?inputValue={
{ item }}" >{
{item}}</navigator> -->
<view class="label" data-value="{
{item}}" bindtap="get_oldsearch" >{
{item}}</view>
</view>
</view>
</view>
<view class="clear" bindtap="clearHis">清除搜索历史