From ecabd20b3dfbd956dad14ffb6ba3dc2efcfdd7c1 Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期一, 25 三月 2024 16:23:32 +0800
Subject: [PATCH] 微信支付

---
 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