|
@@ -1,4 +1,5 @@
|
|
|
import { pages, subPackages, tabBar } from '@/pages.json'
|
|
|
+import { path } from 'node:path'
|
|
|
const getLastPage = () => {
|
|
|
// getCurrentPages() 至少有1个元素,所以不再额外判断
|
|
|
// const lastPage = getCurrentPages().at(-1)
|
|
@@ -34,11 +35,18 @@ export const currRoute = () => {
|
|
|
// console.log('lastPage.$page.options:', currRoute.options)
|
|
|
// console.log('lastPage.options:', (lastPage as any).options)
|
|
|
// 经过多端测试,只有 fullPath 靠谱,其他都不靠谱
|
|
|
+ let path = ''
|
|
|
+ // #ifndef MP-WEIXIN
|
|
|
const { fullPath } = currRoute as { fullPath: string }
|
|
|
+ path = fullPath
|
|
|
+ // #endif
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ path = lastPage.route
|
|
|
+ // #endif
|
|
|
// console.log(fullPath)
|
|
|
// eg: /pages/login/index?redirect=%2Fpages%2Fdemo%2Fbase%2Froute-interceptor (小程序)
|
|
|
// eg: /pages/login/index?redirect=%2Fpages%2Froute-interceptor%2Findex%3Fname%3Dfeige%26age%3D30(h5)
|
|
|
- return getUrlObj(fullPath)
|
|
|
+ return getUrlObj(path)
|
|
|
}
|
|
|
|
|
|
const ensureDecodeURIComponent = (url: string) => {
|