From b273028fde3178d2643312c66d943b12f2c1bfad Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期四, 21 三月 2024 09:26:06 +0800
Subject: [PATCH] 图书分类、图书列表、图书详情·页测试bug修改

---
 custom-tab-bar/index.js |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js
index 3783000..b7ed143 100644
--- a/custom-tab-bar/index.js
+++ b/custom-tab-bar/index.js
@@ -4,15 +4,20 @@
     active: 0,
     list: TabMenu,
   },
-
+  observers: {
+    'active': function (newValue) {
+      console.log('active鍙樺寲', newValue);
+    }
+  },
   methods: {
     onChange(event) {
-      this.setData({ active: event.detail.value });
-      console.log(this.data.active);
+      console.log(event);
+      this.setData({ active: this.data.list[event.detail.value].id });
+      const url = this.data.list[event.detail.value].url.startsWith('/')
+        ? this.data.list[event.detail.value].url
+        : `/${this.data.list[event.detail.value].url}`
       wx.switchTab({
-        url: this.data.list[event.detail.value].url.startsWith('/')
-          ? this.data.list[event.detail.value].url
-          : `/${this.data.list[event.detail.value].url}`,
+        url: url
       });
     },
 

--
Gitblit v1.9.1