From 7a89892d6ac9c181febed610b62f1aeb8145099b Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期六, 03 八月 2024 06:58:48 +0800
Subject: [PATCH] update
---
pages/home/components/home-search.vue | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/pages/home/components/home-search.vue b/pages/home/components/home-search.vue
index aaa32e2..145c14e 100644
--- a/pages/home/components/home-search.vue
+++ b/pages/home/components/home-search.vue
@@ -8,9 +8,15 @@
</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}}
@@ -37,16 +43,25 @@
},
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)
--
Gitblit v1.9.3