// 底部导航只属于三个主页面,二级页面由顶部返回按钮导航。 const paths = {home:'pages/index/index',records:'pages/discover/discover',profile:'pages/profile/profile'}; function tabForPage(route) { const current = String(route || '').replace(/^\//, '').split('?')[0]; return Object.keys(paths).find(function(tab) { return paths[tab] === current; }) || ''; } module.exports = { tabForPage, paths };