转为使用element-plus

This commit is contained in:
2026-01-25 14:09:47 +08:00
parent 5569e73ef1
commit 1134ecb732
73 changed files with 3 additions and 18855 deletions

View File

@@ -1,55 +0,0 @@
<template>
<a-breadcrumb class="breadcrumb">
<a-breadcrumb-item v-for="(item, index) in breadcrumbList" :key="item.path">
<span v-if="index === breadcrumbList.length - 1" class="no-redirect">
<component :is="item.meta?.icon || 'FileTextOutlined'" />
{{ item.meta.title }}
</span>
<a v-else @click.prevent="handleLink(item)">
<component :is="item.meta?.icon || 'HomeOutlined'" />
{{ item.meta.title }}
</a>
</a-breadcrumb-item>
</a-breadcrumb>
</template>
<script setup>
import { ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
// 定义组件名称(多词命名)
defineOptions({
name: 'LayoutBreadcrumb'
})
const route = useRoute()
const router = useRouter()
const breadcrumbList = ref([])
// 获取面包屑列表
const getBreadcrumb = () => {
let matched = route.matched.filter(item => item.meta && item.meta.title)
// 如果第一个不是首页,添加首页
const first = matched[0]
if (first && first.path !== '/') {
matched = [{ path: '/', meta: { title: '首页' } }].concat(matched)
}
breadcrumbList.value = matched
}
// 处理点击面包屑
const handleLink = (item) => {
router.push(item.path)
}
// 监听路由变化
watch(
() => route.path,
() => {
getBreadcrumb()
},
{ immediate: true }
)
</script>