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

1 line
4.2 KiB
Plaintext

{"version":3,"file":"search.js","sources":["../../../../../../src/modules/mall/index/search.vue","../../../../../../uniPage:/bW9kdWxlcy9tYWxsL2luZGV4L3NlYXJjaC52dWU"],"sourcesContent":["<!-- 搜索界面 -->\r\n<template>\r\n <s-layout class=\"set-wrap\" title=\"搜索\" :bgStyle=\"{ color: '#FFF' }\">\r\n <view class=\"ss-p-x-24\">\r\n <view class=\"ss-flex ss-col-center\">\r\n <uni-search-bar\r\n class=\"ss-flex-1\"\r\n radius=\"33\"\r\n placeholder=\"请输入关键字\"\r\n cancelButton=\"none\"\r\n :focus=\"true\"\r\n @confirm=\"onSearch($event.value)\"\r\n />\r\n </view>\r\n <view class=\"ss-flex ss-row-between ss-col-center\">\r\n <view class=\"serach-history\">搜索历史</view>\r\n <button class=\"clean-history ss-reset-button\" @tap=\"onDelete\">清除搜索历史</button>\r\n </view>\r\n <view class=\"ss-flex ss-col-center ss-row-left ss-flex-wrap\">\r\n <button\r\n class=\"history-btn ss-reset-button\"\r\n @tap=\"onSearch(item)\"\r\n v-for=\"(item, index) in state.historyList\"\r\n :key=\"index\"\r\n >\r\n {{ item }}\r\n </button>\r\n </view>\r\n </view>\r\n </s-layout>\r\n</template>\r\n\r\n<script setup>\r\nimport { reactive } from 'vue'\r\nimport sheep from '@/sheep'\r\nimport { onLoad } from '@dcloudio/uni-app'\r\n\r\nconst state = reactive({\r\n historyList: [],\r\n})\r\n\r\n// 搜索\r\nfunction onSearch(keyword) {\r\n if (!keyword) {\r\n return\r\n }\r\n saveSearchHistory(keyword)\r\n // 前往商品列表(带搜索条件)\r\n sheep.$router.go('/modules/mall/goods/list', { keyword })\r\n}\r\n\r\n// 保存搜索历史\r\nfunction saveSearchHistory(keyword) {\r\n // 如果关键词在搜索历史中,则把此关键词先移除\r\n if (state.historyList.includes(keyword)) {\r\n state.historyList.splice(state.historyList.indexOf(keyword), 1)\r\n }\r\n // 置顶关键词\r\n state.historyList.unshift(keyword)\r\n\r\n // 最多保留 10 条记录\r\n if (state.historyList.length >= 10) {\r\n state.historyList.length = 10\r\n }\r\n uni.setStorageSync('searchHistory', state.historyList)\r\n}\r\n\r\nfunction onDelete() {\r\n uni.showModal({\r\n title: '提示',\r\n content: '确认清除搜索历史吗?',\r\n success: function (res) {\r\n if (res.confirm) {\r\n state.historyTag = []\r\n uni.removeStorageSync('searchHistory')\r\n }\r\n },\r\n })\r\n}\r\n\r\nonLoad(() => {\r\n state.historyList = uni.getStorageSync('searchHistory') || []\r\n})\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n \r\n.serach-title {\r\n font-size: 30rpx;\r\n font-weight: 500;\r\n color: #333333;\r\n}\r\n\r\n.uni-searchbar {\r\n padding-left: 0;\r\n}\r\n\r\n.serach-history {\r\n font-size: 30rpx;\r\n font-weight: bold;\r\n color: #333333;\r\n}\r\n\r\n.clean-history {\r\n font-size: 28rpx;\r\n font-weight: 500;\r\n color: #999999;\r\n}\r\n\r\n.history-btn {\r\n max-width: 690rpx;\r\n height: 60rpx;\r\n padding: 0 38rpx;\r\n margin: 0 20rpx 20rpx 0;\r\n font-size: 28rpx;\r\n color: #333333;\r\n background: #f5f6f8;\r\n border-radius: 30rpx;\r\n}\r\n</style>\r\n","import MiniProgramPage from 'D:/App/Work/addr/acdr-ui/src/modules/mall/index/search.vue'\nwx.createPage(MiniProgramPage)"],"names":["reactive","sheep","uni","onLoad"],"mappings":";;;;;;;;;;;;;;;;;AAqCA,UAAA,QAAAA,cAAAA,SAAA;AAAA,MACA,aAAA,CAAA;AAAA,IACA,CAAA;AAGA,aAAA,SAAA,SAAA;AACA,UAAA,CAAA,SAAA;AACA;AAAA,MACA;AACA,wBAAA,OAAA;AAEAC,kBAAAA,MAAA,QAAA,GAAA,4BAAA,EAAA,QAAA,CAAA;AAAA,IACA;AAGA,aAAA,kBAAA,SAAA;AAEA,UAAA,MAAA,YAAA,SAAA,OAAA,GAAA;AACA,cAAA,YAAA,OAAA,MAAA,YAAA,QAAA,OAAA,GAAA,CAAA;AAAA,MACA;AAEA,YAAA,YAAA,QAAA,OAAA;AAGA,UAAA,MAAA,YAAA,UAAA,IAAA;AACA,cAAA,YAAA,SAAA;AAAA,MACA;AACAC,oBAAAA,MAAA,eAAA,iBAAA,MAAA,WAAA;AAAA,IACA;AAEA,aAAA,WAAA;AACAA,oBAAAA,MAAA,UAAA;AAAA,QACA,OAAA;AAAA,QACA,SAAA;AAAA,QACA,SAAA,SAAA,KAAA;AACA,cAAA,IAAA,SAAA;AACA,kBAAA,aAAA,CAAA;AACAA,0BAAA,MAAA,kBAAA,eAAA;AAAA,UACA;AAAA,QACA;AAAA,MACA,CAAA;AAAA,IACA;AAEAC,kBAAAA,OAAA,MAAA;AACA,YAAA,cAAAD,cAAAA,MAAA,eAAA,eAAA,KAAA,CAAA;AAAA,IACA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjFA,GAAG,WAAW,eAAe;"}