File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 77</template >
88
99<script >
10+ import { domTitle , setDocumentTitle } from ' @/utils/domUtil'
11+ import { i18nRender } from ' @/locales'
12+
1013export default {
1114 data () {
1215 return {
1316 }
1417 },
1518 computed: {
1619 locale () {
20+ // 只是为了切换语言时,更新标题
21+ const { title } = this .$route .meta
22+ title && (setDocumentTitle (` ${ i18nRender (title)} - ${ domTitle} ` ))
23+
1724 return this .$i18n .getLocaleMessage (this .$store .getters .lang ).antLocale
1825 }
1926 },
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import '@/components/NProgress/nprogress.less' // progress bar custom style
66import notification from 'ant-design-vue/es/notification'
77import { setDocumentTitle , domTitle } from '@/utils/domUtil'
88import { ACCESS_TOKEN } from '@/store/mutation-types'
9+ import { i18nRender } from '@/locales'
910
1011NProgress . configure ( { showSpinner : false } ) // NProgress Configuration
1112
@@ -15,7 +16,7 @@ const defaultRoutePath = '/dashboard/workplace'
1516
1617router . beforeEach ( ( to , from , next ) => {
1718 NProgress . start ( ) // start progress bar
18- to . meta && ( typeof to . meta . title !== 'undefined' && setDocumentTitle ( `${ to . meta . title } - ${ domTitle } ` ) )
19+ to . meta && ( typeof to . meta . title !== 'undefined' && setDocumentTitle ( `${ i18nRender ( to . meta . title ) } - ${ domTitle } ` ) )
1920 /* has token */
2021 if ( storage . get ( ACCESS_TOKEN ) ) {
2122 if ( to . path === loginRoutePath ) {
You can’t perform that action at this time.
0 commit comments