var e=Object.defineProperty,t=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,l=(t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s;import{r,a as o,E as i,b as n,J as c,f,m as d,i as h,j as u,w as g,l as p,F as m,n as y,k as v,P as b,a1 as k,v as L,a2 as x,D as O,e as S,t as j}from"./index.05ea85f3.js";import{_ as C}from"./plugin-vue_export-helper.21dcd24c.js";var I=C({setup(){const e=r({search:"",historyList:["随便看看"],styleList:["欧式风格","美式风格","中式","亚洲风格"],goback:()=>{b.goBack()},toGoodList:(t,a)=>{if(a){if(!t)return;let a=localStorage.getItem("searchList"),s=null;if(a){s=JSON.parse(a),-1===s.indexOf(e.search)&&s.push(e.search)}else s=[],s.push(e.search);localStorage.setItem("searchList",JSON.stringify(s))}const s=k();1==s.length||"pages/goodList/index"!=s[s.length-2].route?L({url:`/pages/goodList/index?search=${t}`}):x({delta:1,complete:function(){setTimeout((()=>{L({url:`/pages/goodList/index?search=${t}`})}),200)}})},del:()=>{O.confirm({title:"是否清空全部历史记录？"}).then((()=>{e.historyList=[],localStorage.removeItem("searchList")})).catch((()=>{}))}}),f=o();i((()=>{e.search="",e.historyList=localStorage.getItem("searchList")?JSON.parse(localStorage.getItem("searchList")).reverse():[]})),n((()=>{setTimeout((()=>{f.value&&f.value.focus()}))}));const d=c(e);return((e,r)=>{for(var o in r||(r={}))a.call(r,o)&&l(e,o,r[o]);if(t)for(var o of t(r))s.call(r,o)&&l(e,o,r[o]);return e})({searchField:f},d)}},[["render",function(e,t,a,s,l,r){const o=S("van-search"),i=S("van-button"),n=S("van-icon");return f(),d("div",{style:{background:"#f1f5f8",height:"100vh"}},[h("div",{style:{display:"flex","justify-content":"flex-start","align-items":"center",background:"#ffffff"}},[u(o,{clearable:!1,modelValue:e.search,"onUpdate:modelValue":t[0]||(t[0]=t=>e.search=t),style:{flex:"2"},placeholder:"请输入搜索关键词",name:"etaoSearch",ref:"searchField"},null,8,["modelValue"]),u(i,{type:"warning",size:"small",style:{margin:"0 8px",background:"#ff6600"},onClick:t[1]||(t[1]=t=>e.toGoodList(e.search,"search"))},{default:g((()=>[p("搜索")])),_:1}),u(i,{size:"small",style:{"margin-right":"10px"},onClick:e.goback},{default:g((()=>[p("取消")])),_:1},8,["onClick"])]),h("div",null,[h("h4",{style:{color:"#5392e2",padding:"10px"}},[h("span",{style:{float:"right","font-size":"1.3rem",color:"#adaeae"}},[u(n,{name:"delete-o",onClick:e.del},null,8,["onClick"])]),p(" #历史搜索 ")]),h("div",{style:{background:"#ffffff",padding:"10px","line-height":"1.6rem"}},[e.historyList.length>0?(f(),d("div",{key:0},[(f(!0),d(m,null,y(e.historyList,(t=>(f(),d("ul",null,[h("li",{onClick:a=>e.toGoodList(t),style:{border:"1px solid #f1f5f8",margin:"2px auto"}},j(t),9,["onClick"])])))),256))])):(f(),d("p",{key:1},"没有任何历史记录"))]),v('<h4 style="color: #5392e2;padding: 10px;line-height: 2.3rem">#热门搜索</h4>'),v("<div>"),v('<ul style="background: #ffffff;padding: 10px" v-for="item in styleList">'),v('<li @click="toGoodList(item)">{{item}}</li>'),v("</ul>"),v("</div>")])])}]]);export{I as default};
