|
@@ -20,10 +20,20 @@ import subMenu from "./submenu.vue";
|
|
|
import { getPermissionRoutes } from "@/store/permission";
|
|
|
import { RouteName, router } from "@/router";
|
|
|
import { FireRouteName } from "@/app/fire/routeConfig";
|
|
|
+import { watchEffect } from "vue";
|
|
|
|
|
|
const props = defineProps<{ names: string[] }>();
|
|
|
|
|
|
const routes = getPermissionRoutes(props.names, []);
|
|
|
+watchEffect(() => {
|
|
|
+ if (!router.currentRoute.value.name) return;
|
|
|
+
|
|
|
+ if (!routes.some(({ name }) => name === router.currentRoute.value.name)) {
|
|
|
+ router.replace({ name: routes[0].name });
|
|
|
+ }
|
|
|
+
|
|
|
+ // if (routes)
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|