fix: 解决报错
parent
76e3102e64
commit
9e892397c8
|
@ -10,6 +10,7 @@ import { unref } from 'vue'
|
||||||
import { useStore } from 'vuex'
|
import { useStore } from 'vuex'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { pathToRegexp } from 'path-to-regexp'
|
import { pathToRegexp } from 'path-to-regexp'
|
||||||
|
import { isExternalLink } from 'utils/resolvePath'
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
@ -20,6 +21,9 @@ export default function () {
|
||||||
const item = unref(routeMap)[route.path]
|
const item = unref(routeMap)[route.path]
|
||||||
if (item) return item
|
if (item) return item
|
||||||
for (const path in unref(routeMap)) {
|
for (const path in unref(routeMap)) {
|
||||||
|
if (isExternalLink(path)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
const reg = pathToRegexp(path)
|
const reg = pathToRegexp(path)
|
||||||
if (reg.exec(route.path)) {
|
if (reg.exec(route.path)) {
|
||||||
return unref(routeMap)[path]
|
return unref(routeMap)[path]
|
||||||
|
|
Loading…
Reference in New Issue