新增加多语言

This commit is contained in:
不做码农
2022-05-05 18:39:22 +08:00
parent f01ee52512
commit bbe37c04dc
20 changed files with 428 additions and 105 deletions
+1
View File
@@ -2,6 +2,7 @@ const getters = {
sidebar: state => state.app.sidebar,
size: state => state.app.size,
device: state => state.app.device,
language: state => state.app.lang,
visitedViews: state => state.tagsView.visitedViews,
cachedViews: state => state.tagsView.cachedViews,
token: state => state.user.token,
+11 -3
View File
@@ -7,7 +7,8 @@ const state = {
hide: false
},
device: 'desktop',
size: Cookies.get('size') || 'default'
size: Cookies.get('size') || 'default',
lang: Cookies.get('lang') || 'zh-cn'
}
const mutations = {
@@ -37,7 +38,11 @@ const mutations = {
},
SET_SIDEBAR_HIDE: (state, status) => {
state.sidebar.hide = status
}
},
SET_LANG: (state, lang) => {
state.lang = lang
Cookies.set('lang', lang)
},
}
const actions = {
@@ -55,7 +60,10 @@ const actions = {
},
toggleSideBarHide({ commit }, status) {
commit('SET_SIDEBAR_HIDE', status)
}
},
setLang({ commit }, lang) {
commit('SET_LANG', lang)
},
}
export default {