Commit c616fb46 by 林家欣

优化中英文切换代码

parent 1b12742c
...@@ -72,12 +72,11 @@ export default { ...@@ -72,12 +72,11 @@ export default {
watch: { watch: {
$route: { $route: {
handler(val) { handler(val) {
console.log(val, 'val');
const currentRouterComp = val.meta.language; const currentRouterComp = val.meta.language;
if (currentRouterComp.indexOf('英文') !== -1) { if (currentRouterComp && currentRouterComp.indexOf("英文") !== -1) {
this.languageTxt = '英文'; this.languageTxt = "英文";
} else { } else {
this.languageTxt = '中文'; this.languageTxt = "中文";
} }
}, },
immediate: true, immediate: true,
...@@ -87,7 +86,7 @@ export default { ...@@ -87,7 +86,7 @@ export default {
this.user = localStorage.getItem("loginInfo") this.user = localStorage.getItem("loginInfo")
? JSON.parse(localStorage.getItem("loginInfo")) ? JSON.parse(localStorage.getItem("loginInfo"))
: {}; : {};
console.log(this.user); // console.log(this.user);
}, },
data() { data() {
return { return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment