mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
docs(cli): improve document title
This commit is contained in:
parent
f7a1208a18
commit
dd8f37b19c
@ -67,6 +67,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
'$route.path'() {
|
||||||
|
this.setTitle();
|
||||||
|
},
|
||||||
|
|
||||||
lang(val) {
|
lang(val) {
|
||||||
setLang(val);
|
setLang(val);
|
||||||
this.setTitle();
|
this.setTitle();
|
||||||
@ -92,7 +97,18 @@ export default {
|
|||||||
setTitle() {
|
setTitle() {
|
||||||
let { title } = this.config;
|
let { title } = this.config;
|
||||||
|
|
||||||
if (this.config.description) {
|
const navItems = this.config.nav.reduce(
|
||||||
|
(result, nav) => [...result, ...nav.items],
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
const current = navItems.find((item) => {
|
||||||
|
return item.path === this.$route.meta.name;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (current && current.title) {
|
||||||
|
title = current.title + ' - ' + title;
|
||||||
|
} else if (this.config.description) {
|
||||||
title += ` - ${this.config.description}`;
|
title += ` - ${this.config.description}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['switch-version'],
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
$route() {
|
$route() {
|
||||||
this.setNav();
|
this.setNav();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user