fix: getCurrentPages(...).at is not a function
This commit is contained in:
parent
ca8b484b89
commit
c2a587434b
@ -9,7 +9,8 @@ export const getIsTabbar = () => {
|
||||
return false
|
||||
}
|
||||
const pages = getCurrentPages()
|
||||
const currPath = pages.at(-1).route
|
||||
const lastPage = getArrElementByIdx(pages, -1)
|
||||
const currPath = lastPage.route
|
||||
return !!pagesJson.tabBar.list.find((e) => e.pagePath === currPath)
|
||||
}
|
||||
|
||||
@ -24,3 +25,9 @@ export const testI18n = () => {
|
||||
content: t('app.name'),
|
||||
})
|
||||
}
|
||||
|
||||
export const getArrElementByIdx = (arr: any[], index: number) => {
|
||||
if (index < 0) return arr[arr.length + index]
|
||||
if (index >= arr.length) return undefined
|
||||
return arr[index]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user