|
@@ -6,7 +6,7 @@
|
|
|
<div class="content-box d-flex flex-column" :style="`width: ${ !isInWhiteList(route.path, whiteList) ? 'calc(100vw - 230px)' : '100%'}`">
|
|
|
<div v-if="!isInWhiteList(route.path, whiteList)" class="breadcrumbs_sticky">
|
|
|
<div class=" d-flex align-center justify-space-between">
|
|
|
- <v-breadcrumbs :items="breadcrumbs" elevation="3">
|
|
|
+ <v-breadcrumbs :items="system.breadcrumbs" elevation="3">
|
|
|
<template v-slot:item="{ item }">
|
|
|
<span class="text" :class="{active: !item.disabled}" @click="toPath(item)">{{ item.text }}</span>
|
|
|
</template>
|
|
@@ -35,9 +35,11 @@ import Headers from './company/navBar.vue'
|
|
|
import side from './company/side.vue'
|
|
|
import { useRouter, useRoute } from 'vue-router'
|
|
|
import { watch, ref, computed } from 'vue'
|
|
|
+import { useSystem } from '@/store/system'
|
|
|
|
|
|
const router = useRouter()
|
|
|
const route = useRoute()
|
|
|
+const system = useSystem()
|
|
|
const key = computed(() => {
|
|
|
return route.path + Math.random()
|
|
|
})
|
|
@@ -60,31 +62,32 @@ const isInWhiteList = (url, whiteList)=> {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
-const breadcrumbs = ref([])
|
|
|
-const getTitle = (list, fullPath) => {
|
|
|
- const _fullPath = fullPath.split('/')
|
|
|
- const arr = list.map((item, index) => {
|
|
|
- // 重组路径
|
|
|
- if (item.path === list[index - 1]?.path) return false
|
|
|
- const text = item.meta.title
|
|
|
- const _path = item.path.split('/')
|
|
|
- const obj = {
|
|
|
- text,
|
|
|
- to: _path.map((e, i) => _fullPath[i]).join('/')
|
|
|
- }
|
|
|
- return obj
|
|
|
- }).filter(e => e) || []
|
|
|
- if (arr?.length) {
|
|
|
- arr[arr.length - 1].disabled = true
|
|
|
- arr[arr.length - 1].link = true
|
|
|
- }
|
|
|
- breadcrumbs.value = arr
|
|
|
-}
|
|
|
+// const breadcrumbs = ref([])
|
|
|
+// const getTitle = (list, fullPath) => {
|
|
|
+// const _fullPath = fullPath.split('/')
|
|
|
+// const arr = list.map((item, index) => {
|
|
|
+// // 重组路径
|
|
|
+// if (item.path === list[index - 1]?.path) return false
|
|
|
+// const text = item.meta.title
|
|
|
+// const _path = item.path.split('/')
|
|
|
+// const obj = {
|
|
|
+// text,
|
|
|
+// to: _path.map((e, i) => _fullPath[i]).join('/')
|
|
|
+// }
|
|
|
+// return obj
|
|
|
+// }).filter(e => e) || []
|
|
|
+// if (arr?.length) {
|
|
|
+// arr[arr.length - 1].disabled = true
|
|
|
+// arr[arr.length - 1].link = true
|
|
|
+// }
|
|
|
+// breadcrumbs.value = arr
|
|
|
+// }
|
|
|
|
|
|
watch(
|
|
|
() => route.matched,
|
|
|
(val) => {
|
|
|
- getTitle(val, route.fullPath)
|
|
|
+ // getTitle(val, route.fullPath)
|
|
|
+ system.setBreadcrumbs(val, route.fullPath)
|
|
|
},
|
|
|
{ immediate: true },
|
|
|
{ deep: true }
|