From bc63cd0e8e9c380be145f23f3456235d124a50d9 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期五, 29 三月 2024 14:38:17 +0800 Subject: [PATCH] 播放按钮图片 --- custom-tab-bar/index.js | 27 ++++----------------------- 1 files changed, 4 insertions(+), 23 deletions(-) diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index a38dc4a..12e886b 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 }); - // }, + } }, }); -- Gitblit v1.9.1