| | |
| | | </template> |
| | | </u-input> |
| | | </view> |
| | | |
| | | </view> |
| | | <view class="m-t-12"> |
| | | <view class="title">搜索历史</view> |
| | | <view class="title flex"> |
| | | <view class="m-l-0 m-r-a">搜索历史</view> |
| | | <view class="bg-white desc-gray text-center m-l-a m-r-0" @click.stop="clearHistory"> |
| | | 一键清空 |
| | | </view> |
| | | </view> |
| | | <view class="m-t-12 flex flex-wrap-normal history-item-list"> |
| | | <view class="history-item" v-for="item of history" :key="item" @click="searchBy(item)"> |
| | | {{item}} |
| | |
| | | }, |
| | | methods: { |
| | | buttonSearchFlow() { |
| | | var name = this.search_flow |
| | | if (this.history.indexOf(name) >= 0) { |
| | | this.history.splice(this.history.indexOf(name), 1) |
| | | } |
| | | this.history.unshift(name) |
| | | if (this.history.length >= 10) { |
| | | this.history.splice(this.history.length - 1, 1) |
| | | } |
| | | |
| | | console.log('buttonSearchFlow') |
| | | uni.navigateTo({ |
| | | url: '/sub_pages/customer/trade/list?name=' + this.search_flow |
| | | }) |
| | | }, |
| | | async clearHistory() { |
| | | await this.$message.confirm('是否清空历史记录') |
| | | this.history = [] |
| | | this.$storage.setItem("cache_home_search", JSON.stringify(this.history)) |
| | | }, |
| | | searchBy(name) { |
| | | if (this.history.indexOf(name) >= 0) { |
| | | this.history.splice(this.history.indexOf(name), 1) |