fix: 当获取不到lang的时候提供默认值
This commit is contained in:
@@ -81,7 +81,11 @@ Vue.use(Element, {
|
|||||||
|
|
||||||
Vue.prototype.$langPre = {
|
Vue.prototype.$langPre = {
|
||||||
computedProp(suffix) {
|
computedProp(suffix) {
|
||||||
return localStorage.getItem('lang') + '_' + suffix
|
let item = localStorage.getItem('lang');
|
||||||
|
if (item === null) {
|
||||||
|
item = 'zh'
|
||||||
|
}
|
||||||
|
return item + '_' + suffix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user