fix(utils): 处理未找到lastPage时的currRoute返回
当getLastPage返回undefined时,currRoute现在会返回包含空path和空query的默认对象,避免潜在的运行时错误
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user