From 63820a55496e99f54d68a1f16e3f6f606c582120 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 11 二月 2026 09:11:16 +0800
Subject: [PATCH] 调试代码
---
mini-program/pages/search/search.vue | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/mini-program/pages/search/search.vue b/mini-program/pages/search/search.vue
index d7b2310..2700b46 100644
--- a/mini-program/pages/search/search.vue
+++ b/mini-program/pages/search/search.vue
@@ -4,10 +4,10 @@
<u-search placeholder="璇疯緭鍏ュ晢鍝佸悕绉版悳绱�" height="36" searchIconColor="#999999" borderColor="#EEEEEE"
bgColor="#F9F9FB" :showAction="false" v-model="goodsName" @search="search" />
</view>
- <view class="history">
+ <view class="history" v-if="historyList && historyList.length > 0">
<view class="history-title">鍘嗗彶鎼滅储</view>
<view class="history-list">
- <view class="history-list-item">鏀噸杞�</view>
+ <view class="history-list-item" v-for="(item, index) in historyList" :key="index">{{item.content}}</view>
</view>
</view>
<template v-if="isSearch">
@@ -42,20 +42,39 @@
</template>
<script>
+ import { mapState } from 'vuex'
export default {
+ computed: {
+ ...mapState(['userInfo'])
+ },
data() {
return {
goodsName: '',
goodsList: [],
page: 1,
next: true,
- isSearch: false
+ isSearch: false,
+ historyList: []
};
+ },
+ onLoad() {
+ this.gethistary()
},
onReachBottom() {
this.getGoodsList()
},
methods: {
+ gethistary() {
+ if (!this.userInfo) return
+ this.$u.api.searchHistoryList({
+ memberId: this.userInfo.id
+ }).then(res => {
+ if (res.code === 200) {
+ console.log(res)
+ this.historyList = res.data
+ }
+ })
+ },
search() {
if (!this.isSearch) {
this.isSearch = true
--
Gitblit v1.9.3