From f46786f11c5c08ead7501a82e5a71430ad69b782 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期日, 27 四月 2025 17:39:24 +0800 Subject: [PATCH] 修复线索问题定位错误问题 --- custom-tab-bar/index.js | 31 +++++++++++++++++++++++++++---- 1 files changed, 27 insertions(+), 4 deletions(-) diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index 4384ee3..5933a2c 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -1,10 +1,35 @@ import TabMenu from './data'; +// import { getMenu } from './data'; + +const app = getApp(); + Component({ data: { active: 0, list: TabMenu, + // list: getMenu(app.globalData.userInfo.usertypeid), }, - + attached() { + // const menu = []; + // TabMenu.forEach(v => { + // if (app.globalData.userInfo.usertypeid <= v.level) { + // menu.push(v); + // } + // }); + // this.setData({ list: menu }); + // const index = []; + // TabMenu.forEach((v, i) => { + // if (app.globalData.userInfo.usertypeid > v.level) { + // index.push(i); + // } + // }); + // let offset = 0; + // index.forEach(e => { + // TabMenu.splice(e + offset, 1); + // offset--; + // }); + // this.setData({ list: TabMenu }); + }, methods: { onChange(event) { let index = event.detail.value; @@ -29,9 +54,7 @@ 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}`, + item => (item.url.startsWith('/') ? item.url.substr(1) : item.url) === `${route}`, ); this.setData({ active }); }, -- Gitblit v1.9.3