From 2ee8ddb1ecac7df4198e54e08ec7f22daf4b07c0 Mon Sep 17 00:00:00 2001
From: QYF-GitLab1 <1940665526@qq.com>
Date: 星期五, 03 一月 2025 16:57:38 +0800
Subject: [PATCH] 111

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

diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js
index a38dc4a..edef97d 100644
--- a/custom-tab-bar/index.js
+++ b/custom-tab-bar/index.js
@@ -1,34 +1,15 @@
 import TabMenu from './data';
 Component({
   data: {
-    selected: 0,
+    active: 0,
     list: TabMenu,
   },
-  // observers: {
-  //   'active': function (newValue) {
-  //     console.log('active鍙樺寲', newValue);
-  //   }
-  // },
   methods: {
     changeTab(item) {
-      this.setData({
-        selected: item.currentTarget.dataset.num
-      })
       wx.switchTab({
-        url: this.data.list[this.data.selected].url.startsWith('/') ?
-          this.data.list[this.data.selected].url : `/${this.data.list[this.data.selected].url}`,
+        url: this.data.list[item.currentTarget.dataset.num].url.startsWith('/') ?
+          this.data.list[item.currentTarget.dataset.num].url : `/${this.data.list[item.currentTarget.dataset.num].url}`,
       });
-    },
-
-    // init() {
-    //   const page = getCurrentPages().pop();
-    //   const route = page ? page.route.split('?')[0] : '';
-    //   const active = this.data.list.findIndex(
-    //     (item) =>
-    //       (item.url.startsWith('/') ? item.url.substr(1) : item.url) ===
-    //       `${route}`,
-    //   );
-    //   this.setData({ active });
-    // },
+    }
   },
-});
+});
\ No newline at end of file

--
Gitblit v1.9.1