|
@@ -1,6 +1,6 @@
|
|
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
|
import { routes } from './config'
|
|
|
-import { computed } from 'vue'
|
|
|
+import { computed, ref, watchEffect } from 'vue'
|
|
|
import { RoutesName } from './constant'
|
|
|
import { metas } from './constant'
|
|
|
|
|
@@ -39,8 +39,19 @@ export const getRouteConfig = (name: RoutesName, raw: RouteRaw[] = routes): Rout
|
|
|
}
|
|
|
return current
|
|
|
}
|
|
|
+const getName = () => {
|
|
|
+ if (!router.currentRoute.value?.name) {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ return getRouteNames(router.currentRoute.value.name as RoutesName, routes);
|
|
|
+}
|
|
|
|
|
|
-export const currentRouteNames = computed(() => getRouteNames(router.currentRoute.value.name as RoutesName, routes))
|
|
|
+export const currentRouteNames = ref(getName())
|
|
|
+setInterval(() => {
|
|
|
+ currentRouteNames.value = getName()
|
|
|
+ // console.log(getName())
|
|
|
+}, 100)
|
|
|
+// export const currentRouteNames = computed(() => getRouteNames(router.currentRoute.value.name as RoutesName, routes))
|
|
|
|
|
|
export const currentLayout = computed(() => {
|
|
|
const names = currentRouteNames.value
|