const app = getApp(); function tabberFunc (active, path) { if (active) return false; const routes = getCurrentPages(); let _index = 0; routes.forEach((item, index) => item.route == path ? _index = routes.length - index - 1 : ''); _index > 0 ? wx.navigateBack({ delta: _index }) : wx.navigateTo({ url: "/" + path }) } module.exports = { tabberFunc }