feat: 支持无tabbar
This commit is contained in:
parent
2975fcec92
commit
1baec3728f
@ -16,6 +16,7 @@ export default defineUniPages({
|
||||
'z-paging/components/z-paging$1/z-paging$1.vue',
|
||||
},
|
||||
},
|
||||
// 如果不需要tabBar,可以注释掉这个配置,或者直接删除
|
||||
tabBar: {
|
||||
color: '#999999',
|
||||
selectedColor: '#018d71',
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { pages, subPackages, tabBar } from '@/pages.json'
|
||||
import pagesConfig from '@/pages.json'
|
||||
import { isMpWeixin } from './platform'
|
||||
|
||||
const { pages, subPackages, tabBar = { list: [] } } = { ...pagesConfig }
|
||||
|
||||
export const getLastPage = () => {
|
||||
// getCurrentPages() 至少有1个元素,所以不再额外判断
|
||||
// const lastPage = getCurrentPages().at(-1)
|
||||
@ -11,16 +13,14 @@ export const getLastPage = () => {
|
||||
|
||||
/** 判断当前页面是否是 tabbar 页 */
|
||||
export const getIsTabbar = () => {
|
||||
if (!tabBar) {
|
||||
try {
|
||||
const lastPage = getLastPage()
|
||||
const currPath = lastPage?.route
|
||||
|
||||
return Boolean(tabBar?.list?.some((item) => item.pagePath === currPath))
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
if (!tabBar.list.length) {
|
||||
// 通常有 tabBar 的话,list 不能有空,且至少有2个元素,这里其实不用处理
|
||||
return false
|
||||
}
|
||||
const lastPage = getLastPage()
|
||||
const currPath = lastPage.route
|
||||
return !!tabBar.list.find((e) => e.pagePath === currPath)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user