From bc7b375c7dd6b256ebd582c4ab85f77fca8dc054 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期四, 21 三月 2024 14:54:55 +0800
Subject: [PATCH] Merge refs/remotes/origin/master into refs/heads/master

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

diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js
index 90c58df..b7ed143 100644
--- a/custom-tab-bar/index.js
+++ b/custom-tab-bar/index.js
@@ -4,14 +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(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