修改语言切换重新登录之后出现的问题
This commit is contained in:
@@ -21,12 +21,12 @@
|
||||
Navigation: '文档管理',
|
||||
subNavigation: null,
|
||||
selectedKeys: [],
|
||||
openKeys:[],
|
||||
openKeys: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$route': function(val) {
|
||||
if (val.meta.title == '首页') {
|
||||
if (val.meta.title == '首页' || val.meta.title === ' home page') {
|
||||
this.Navigation = val.meta.title
|
||||
this.subNavigation = null
|
||||
} else {
|
||||
@@ -35,7 +35,8 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.$route.meta.title == '首页') {
|
||||
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
|
||||
} else {
|
||||
@@ -56,7 +57,7 @@
|
||||
routes.forEach(item => {
|
||||
this.openKeys.push(item)
|
||||
})
|
||||
this.Navigation =this.openKeys[1].meta.title
|
||||
this.Navigation = this.openKeys[1].meta.title
|
||||
this.subNavigation = this.$route.meta.title
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
import 'moment/locale/zh-cn'
|
||||
import { generateIndexRouter } from '@/utils/util'
|
||||
import store from '../../store'
|
||||
import router,{resetRouter} from '../../router'
|
||||
import router, { resetRouter } from '../../router'
|
||||
|
||||
moment.locale('zh-cn')
|
||||
const EN = 'en-us'
|
||||
@@ -170,6 +170,15 @@
|
||||
}
|
||||
}
|
||||
this.localeval = localStorage.getItem('language')
|
||||
if (this.localeval == 'zh-cn') {
|
||||
this.$i18n.locale = ZH
|
||||
this.locale = zhCN
|
||||
moment.locale('zh-cn')
|
||||
} else if (this.localeval == 'en-us') {
|
||||
this.locale = enUS
|
||||
moment.locale('en-us')
|
||||
this.$i18n.locale = EN
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
@@ -292,7 +301,6 @@
|
||||
/*update_end author:liushaoqian date:20200507 for: 刷新缓存*/
|
||||
moment,
|
||||
changeLocale(localeval) {
|
||||
console.log(localeval)
|
||||
this.isLoading = true
|
||||
switch (localeval) {
|
||||
case 'zh-cn':
|
||||
@@ -303,10 +311,10 @@
|
||||
break
|
||||
}
|
||||
store.dispatch('GetPermissionList').then(res => {
|
||||
const menuData = res.result.menu;
|
||||
const menuData = res.result.menu
|
||||
resetRouter()
|
||||
let constRoutes = [];
|
||||
constRoutes = generateIndexRouter(menuData);
|
||||
let constRoutes = []
|
||||
constRoutes = generateIndexRouter(menuData)
|
||||
router.addRoutes(constRoutes)
|
||||
this.$root.Bus.$emit('switchLanguage', localeval)
|
||||
this.isLoading = false
|
||||
|
||||
Reference in New Issue
Block a user