You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/public/assets/pages-search-index.f5009bc5.js

2 lines
2.2 KiB

11 months ago
import{o as s,c as a,w as e,n as t,i as c,a as l,f as o,b as r,d as i,F as h,e as n,l as u,I as d,t as f}from"./index-4ddb689d.js";import{_ as p}from"./_plugin-vue_export-helper.1b428a4d.js";const y=p({data:()=>({historySearch:[],searchValue:""}),onLoad(s){this.historySearch=this.getHistorySearch()},methods:{getHistorySearch:()=>uni.getStorageSync("historySearch")||[],onSearch(){const{searchValue:s}=this;s&&(this.setHistory(s),this.$navTo("pages/goods/list",{search:s}))},setHistory(s){const a=this.getHistorySearch(),e=a.indexOf(s);e>-1&&a.splice(e,1),a.unshift(s),this.historySearch=a,this.onUpdateStorage()},clearSearch(){this.historySearch=[],this.onUpdateStorage()},onUpdateStorage(s){uni.setStorageSync("historySearch",this.historySearch)},handleQuick(s){this.$navTo("pages/goods/list",{search:s})}}},[["render",function(p,y,S,_,g,k){const m=u,V=c,C=d;return s(),a(V,{class:"container",style:t(p.appThemeStyle)},{default:e((()=>[l(V,{class:"search-wrapper"},{default:e((()=>[l(V,{class:"search-input"},{default:e((()=>[l(V,{class:"search-input-wrapper"},{default:e((()=>[l(V,{class:"left"},{default:e((()=>[l(m,{class:"search-icon iconfont icon-search"})])),_:1}),l(V,{class:"right"},{default:e((()=>[l(C,{modelValue:g.searchValue,"onUpdate:modelValue":y[0]||(y[0]=s=>g.searchValue=s),class:"input",focus:"true",placeholder:"请输入您搜索的商品",type:"text"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),l(V,{class:"search-button"},{default:e((()=>[l(V,{class:"button",onClick:k.onSearch},{default:e((()=>[o("搜索")])),_:1},8,["onClick"])])),_:1})])),_:1}),g.historySearch.length?(s(),a(V,{key:0,class:"history"},{default:e((()=>[l(V,{class:"his-head"},{default:e((()=>[l(m,{class:"title"},{default:e((()=>[o("最近搜索")])),_:1}),l(m,{class:"icon iconfont icon-delete",onClick:k.clearSearch},null,8,["onClick"])])),_:1}),l(V,{class:"his-list"},{default:e((()=>[(s(!0),r(h,null,i(g.historySearch,((t,c)=>(s(),a(V,{class:"his-item",key:c},{default:e((()=>[l(V,{class:"history-button",onClick:s=>k.handleQuick(t)},{default:e((()=>[o(f(t),1)])),_:2},1032,["onClick"])])),_:2},1024)))),128))])),_:1})])),_:1})):n("",!0)])),_:1},8,["style"])}],["__scopeId","data-v-1bdf4694"]]);export{y as default};