feat : 修改菜单状态

This commit is contained in:
clay
2024-05-23 14:49:56 +08:00
parent 21f90e438c
commit e9e5a0c785
9 changed files with 36 additions and 21 deletions

View File

@@ -12,13 +12,13 @@
</template>
<script setup>
import { useRoute, useRouter } from 'vue-router';
import {useRoute, useRouter} from 'vue-router';
const route = useRoute()
const router = useRouter()
watch(route, ()=> {
watch(route, () => {
getBreadcrumb()
})
@@ -29,7 +29,7 @@ const breadcrumbList = ref([])
const getBreadcrumb = () => {
let matched = route.matched.filter(item => item.meta && item.meta.title)
const first = matched[0]
if(!isDashboard(first)) {
if (!isDashboard(first)) {
matched = [{path: '/home', meta: {title: '首页'}}].concat(matched)
}
breadcrumbList.value.length = 0;
@@ -39,7 +39,7 @@ const getBreadcrumb = () => {
const isDashboard = (meta) => {
const name = meta && meta.name
if(!name) {
if (!name) {
return
}
return name.trim().toLocaleLowerCase() === 'Home'.toLocaleLowerCase()