zb-admin/src/components/u-Hamburger/index.vue

31 lines
974 B
Vue
Raw Normal View History

2022-04-01 09:07:38 +00:00
<template>
<el-breadcrumb class="app-breadcrumb" separator="/">
2022-09-12 16:11:45 +00:00
<transition-group name="breadcrumb" mode="out-in">
2022-09-28 14:06:33 +00:00
<el-breadcrumb-item v-for="(item, index) in matched" :key="item.name">
<span v-if="item.redirect === 'noRedirect' || index == matched.length - 1" class="no-redirect">{{ item.meta.title }}</span>
2022-04-01 09:07:38 +00:00
<a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
</el-breadcrumb-item>
</transition-group>
</el-breadcrumb>
</template>
<script lang="ts" setup>
import pathToRegexp from 'path-to-regexp'
2022-09-28 14:06:33 +00:00
import { onMounted, ref, watch,computed } from 'vue'
import { useRoute ,useRouter} from 'vue-router'
2022-04-01 09:07:38 +00:00
2022-09-28 09:08:12 +00:00
const levelList = ref([])
2022-04-01 09:07:38 +00:00
const route = useRoute()
2022-09-28 14:06:33 +00:00
const router = useRouter()
2022-04-01 09:07:38 +00:00
2022-09-28 14:06:33 +00:00
const handleLink = (item)=>{
router.push({
path:item.path
})
2022-04-01 09:07:38 +00:00
}
2022-09-28 09:08:12 +00:00
2022-09-28 14:06:33 +00:00
const matched = computed(() => route.matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false));
2022-09-28 09:08:12 +00:00
2022-04-01 09:07:38 +00:00
</script>