acdr-ui/dist/build/mp-weixin/modules/mall/index/search.js

2 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";const e=require("../../../common/vendor.js"),t=require("../../../sheep/index.js");if(!Array){(e.resolveComponent("uni-search-bar")+e.resolveComponent("s-layout")+e.resolveComponent("layout-default-uni"))()}Math||((()=>"../../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js")+(()=>"../../../sheep/components/s-layout/s-layout.js"))();const o={__name:"search",setup(o){const s=e.reactive({historyList:[]});function i(o){o&&(!function(t){s.historyList.includes(t)&&s.historyList.splice(s.historyList.indexOf(t),1);s.historyList.unshift(t),s.historyList.length>=10&&(s.historyList.length=10);e.index.setStorageSync("searchHistory",s.historyList)}(o),t.sheep.$router.go("/modules/mall/goods/list",{keyword:o}))}function r(){e.index.showModal({title:"提示",content:"确认清除搜索历史吗?",success:function(t){t.confirm&&(s.historyTag=[],e.index.removeStorageSync("searchHistory"))}})}return e.onLoad((()=>{s.historyList=e.index.getStorageSync("searchHistory")||[]})),(t,o)=>({a:e.o((e=>i(e.value))),b:e.p({radius:"33",placeholder:"请输入关键字",cancelButton:"none",focus:!0}),c:e.o(r),d:e.f(s.historyList,((t,o,s)=>({a:e.t(t),b:e.o((e=>i(t)),o),c:o}))),e:e.p({title:"搜索",bgStyle:{color:"#FFF"}})})}},s=e._export_sfc(o,[["__scopeId","data-v-9320d285"]]);wx.createPage(s);