wxml:
viewclass='search_history'wx:if="{{isShow}}"viewclass='history_title'最近搜索/viewviewclass='history_item'wx:for="{{searchRecord}}"wx:key="{{index}}"wx:for-item="hisItem"textbindtap='search_his'data-his="{{hisItem}}"{{hisItem}}/text/viewviewclass='history_titleclear'bindtap='clear_search'清空搜索历史/view/viewwxss:
.search_history{height:auto;width:95%;position:relative;background-color:#fff;border-radius:5rpx;font-size:30rpx;color:#000;text-align:left;}.history_title{color:#999;text-align:left;padding:10rpx;}.history_item{display:inline-block;padding:10rpx15rpx;background-color:rgb(248,246,246);margin:10rpx;border-radius:10rpx;}.clear{display:inline-block;padding:10rpx15rpx;background-color:#66d7fa;color:#fff;margin:10rpx;border-radius:10rpx;}js:
//js用到的全局变量Page({data:{isShow:false,searchRecord:[],},//搜索的时候缓存到本地searchBox:function(e){letthat=this;letinputVal=e.detail.value.ip;letsearchRecord=this.data.searchRecord;if(inputVal==""){that.setData({ip:inputVal})return}else{if(searchRecord.length10){searchRecord.unshift(inputVal);}else{searchRecord.pop();searchRecord.unshift(inputVal);}//将历史记录数组整体储存到缓存中wx.setStorageSync('searchRecord',Array.from(newSet(searchRecord)));}that.setData({ip:e.detail.value.ip})},//缓存历史openHistorySearch:function(){letthat=this;that.setData({searchRecord:wx.getStorageSync('searchRecord')||[],//若无储存则为空})console.log(that.data.searchRecord);},//清空搜索历史clear_search:function(){letthat=this;wx.clearStorageSync('searhRecord')that.setData({searchRecord:[],isShow:false})},//点击历史搜索search_his:function(e){letthat=this;lethis=e.currentTarget.dataset.his;that.setData({ip:his,isShow:false});that.search_host();},})
最新资讯
-

小程序制作平台选型踩坑记录:2026年五大主流方案横向对比
2026 年微信小程序月活达 10.7 亿、覆盖 108 个行业,本次横向对比即速应用、乔拓云、凡科、有赞、微盟五大主流平台,分三阶段给出选型结论,核心聚焦成本、扩展性、运营能力三大维度。 -

即速应用,赋能企业玩转微信小程序智慧经营
作为国内领军的智慧商业经营服务商,即速应用始终秉承“让每个企业都拥有自己的智慧店铺”的愿景,持续赋能更多企业玩转智慧经营。即速应用旗下拥有“小程序搭建工具-即速应用”、“私域流量专家-即客云”等产品,帮助商家打通互联网全生态营销闭环。 -

即客云2.0重磅更新,让微信小程序运营更简单!
即客云作为一款基于企业微信的第三方工具,现从多维度提供超过30种功能,自上线以来,已服务多家企业,受到一致好评。近期,我们根据客户反馈和市场调研正式推出升级版 即客云2.0!更新了私域运营SOP,群日历功能,批量拓客,客户雷达,消息推送,个人欢迎语,帮助企业更好运用企业微信;同时提升了社群运营工作标准化,提升运营效率,帮助企业实现客户增长,玩转私域流量。










