fix(utils): 处理未找到lastPage时的currRoute返回

当getLastPage返回undefined时,currRoute现在会返回包含空path和空query的默认对象,避免潜在的运行时错误
This commit is contained in:
feige996
2025-09-01 15:55:16 +08:00
parent 40732df4d8
commit 83e08353eb

View File

@@ -16,6 +16,12 @@ export function getLastPage() {
*/
export function currRoute() {
const lastPage = getLastPage()
if (!lastPage) {
return {
path: '',
query: {},
}
}
const currRoute = (lastPage as any).$page
// console.log('lastPage.$page:', currRoute)
// console.log('lastPage.$page.fullpath:', currRoute.fullPath)