99 lines
2.2 KiB
Java
99 lines
2.2 KiB
Java
<template>
|
|
<div class="box">
|
|
<span class="box-text">
|
|
{{Navigation}}
|
|
</span>
|
|
<span class="box-text-content" v-if="subNavigation">
|
|
<img src="~@/assets/dayu.png" alt="">
|
|
</span>
|
|
<span class="box-text-text">
|
|
{{subNavigation}}
|
|
</span>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'Tabcrumbs',
|
|
props: ['menuTitle'],
|
|
data() {
|
|
return {
|
|
Navigation: '文档管理',
|
|
subNavigation: null,
|
|
selectedKeys: [],
|
|
openKeys: []
|
|
}
|
|
},
|
|
watch: {
|
|
'$route': function(val) {
|
|
if (val.meta.title == '首页' ||
|
|
val.meta.title === ' Home Page') {
|
|
this.Navigation = val.meta.title
|
|
this.subNavigation = null
|
|
} else {
|
|
this.updateMenu()
|
|
}
|
|
}
|
|
},
|
|
mounted() {
|
|
console.log(this.$route.meta)
|
|
if (this.$route.meta.title === '首页' ||
|
|
this.$route.meta.title === ' Home Page') {
|
|
this.Navigation = this.$route.meta.title
|
|
this.subNavigation = null
|
|
let projectTitle = '蔚来全球法规平台'
|
|
document.title = projectTitle
|
|
} else {
|
|
this.updateMenu()
|
|
}
|
|
},
|
|
methods: {
|
|
updateMenu() {
|
|
let projectTitle = '蔚来全球法规平台'
|
|
const routes = this.$route.matched.concat()
|
|
const { hidden } = this.$route.meta
|
|
if (routes.length >= 3 && hidden) {
|
|
routes.pop()
|
|
this.selectedKeys = [routes[routes.length - 1].path]
|
|
} else {
|
|
this.selectedKeys = [routes.pop().path]
|
|
}
|
|
this.openKeys = []
|
|
routes.forEach(item => {
|
|
this.openKeys.push(item)
|
|
})
|
|
this.Navigation = this.openKeys[1].meta.title
|
|
this.subNavigation = this.$route.meta.title
|
|
document.title = this.subNavigation + ' · ' + projectTitle
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.box {
|
|
width: 100%;
|
|
height: 72px;
|
|
line-height: 92px;
|
|
padding: 0 24px;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.box-text {
|
|
font-size: 20px;
|
|
color: #040B29;
|
|
font-weight: 400;
|
|
opacity: 0.5;
|
|
}
|
|
|
|
.box-text-content {
|
|
margin-left: 5px;
|
|
margin-right: 5px;
|
|
}
|
|
|
|
.box-text-text {
|
|
font-weight: 400;
|
|
color: #040B29;
|
|
font-size: 20px;
|
|
}
|
|
</style> |