feat(utils): 添加判断当前页面是否为tabbar页面的功能
新增isCurrentPageTabbar函数,用于检查当前页面是否属于tabbar配置中的页面
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { pages, subPackages } from '@/pages.json'
|
||||
import { tabbarList } from '@/tabbar/config'
|
||||
import { isMpWeixin } from './platform'
|
||||
|
||||
export function getLastPage() {
|
||||
@@ -9,6 +10,13 @@ export function getLastPage() {
|
||||
return pages[pages.length - 1]
|
||||
}
|
||||
|
||||
export function isCurrentPageTabbar() {
|
||||
const lastPage = getLastPage()
|
||||
const currRoute = (lastPage as any).$page
|
||||
const { fullPath } = currRoute as { fullPath: string }
|
||||
return tabbarList.some(item => `/${item.path}` === fullPath)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前页面路由的 path 路径和 redirectPath 路径
|
||||
* path 如 '/pages/login/index'
|
||||
|
||||
Reference in New Issue
Block a user