From 36b2ce21114082da777b66b4bda250c9ca7ecd30 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期四, 21 三月 2024 14:38:25 +0800 Subject: [PATCH] Merge refs/remotes/origin/master into refs/heads/master --- 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