修正使用重定向时左侧菜单不会跟踪的问题
This commit is contained in:
parent
42ed4f08b5
commit
d27db128ea
|
@ -11,7 +11,7 @@
|
|||
:collapse-transition="false"
|
||||
mode="vertical"
|
||||
>
|
||||
<sidebar-item v-for="route in allRoutes" :key="route.path" :item="route" :base-path="route.path" />
|
||||
<sidebar-item v-for="r in allRoutes" :key="r.path" :item="r" :base-path="r.path" />
|
||||
</el-menu>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
|
@ -20,18 +20,16 @@
|
|||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { storeToRefs } from 'pinia/dist/pinia'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useRoute } from "vue-router";
|
||||
import Logo from './Logo.vue'
|
||||
import SidebarItem from './SidebarItem.vue'
|
||||
import { useBasicStore } from '@/store/basic'
|
||||
const { settings, allRoutes, sidebar } = storeToRefs(useBasicStore())
|
||||
const { meta, path } = useRoute()
|
||||
const activeMenu = computed(() => {
|
||||
// if set path, the sidebar will highlight the path you set
|
||||
if (meta.activeMenu) {
|
||||
return meta.activeMenu
|
||||
}
|
||||
return path
|
||||
const route = useRoute()
|
||||
const activeMenu = ref<any>(route.path);
|
||||
|
||||
watch(() => route.path, val => {
|
||||
activeMenu.value = val
|
||||
})
|
||||
</script>
|
||||
<style lang="scss">
|
||||
|
|
Loading…
Reference in New Issue
Block a user