doc: update document title, close #5121

pull/5147/head
tangjinzhou 2022-01-06 15:58:42 +08:00
parent 0a5dbf3642
commit ab2df12cce
3 changed files with 24 additions and 4 deletions

View File

@ -11,7 +11,7 @@
name="description"
content="An enterprise-class UI components based on Ant Design and Vue"
/>
<title>Ant Design Vue</title>
<title>Ant Design Vue — An enterprise-class UI components based on Ant Design and Vue.js</title>
<meta
name="keywords"
content="ant design vue,ant-design-vue,ant-design-vue admin,ant design pro,vue ant design,vue ant design pro,vue ant design admin,ant design vue官网,ant design vue中文文档,ant design vue文档"

View File

@ -42,16 +42,36 @@
</template>
<script lang="ts">
import { getLocalizedPathname } from '../utils/util';
import { computed, defineComponent } from 'vue';
import { computed, defineComponent, watch } from 'vue';
import { useRoute } from 'vue-router';
export default defineComponent({
name: 'Menu',
props: ['menus', 'isZhCN', 'activeMenuItem'],
setup() {
setup(props) {
const route = useRoute();
const showOverview = computed(() => {
return route.path.indexOf('/components') === 0;
});
watch(
[() => props.activeMenuItem, () => props.isZhCN, () => props.menus],
() => {
const menus = props.menus.reduce(
(pre, current) => [...pre, current, ...(current.children || [])],
[{ path: '/components/overview', title: '组件总览', enTitle: 'Components Overview' }],
);
const item = menus.find(m => m.path === props.activeMenuItem);
let title = props.isZhCN
? 'Ant Design Vue - 一套企业级 Vue 组件库'
: 'Ant Design Vue — An enterprise-class UI components based on Ant Design and Vue.js';
if (item && item.title) {
title = props.isZhCN
? `${item.subtitle || ''} ${item.title} - Ant Design Vue`
: `${item.enTitle || item.title} - Ant Design Vue`;
}
document.title = title.trim();
},
{ immediate: true, flush: 'post' },
);
return {
getLocalizedPathname,
showOverview,

View File

@ -162,7 +162,7 @@ const routes = [
],
},
{ path: '/debugger', component: () => import('../../debugger') },
{ path: '/:lang(.*)', redirect: '/components/overview/' },
{ path: '/:lang(.*)', redirect: '/components/overview' },
];
export default createRouter({