Files
crawlab/frontend/src/store/modules/lang.js
2019-03-23 23:48:08 +08:00

32 lines
450 B
JavaScript

const state = {
lang: window.localStorage.getItem('lang') || 'en'
}
const getters = {
lang (state) {
if (state.lang === 'en') {
return 'English'
} else if (state.lang === 'zh') {
return '中文'
} else {
return state.lang
}
}
}
const mutations = {
SET_LANG (state, value) {
state.lang = value
}
}
const actions = {}
export default {
namespaced: true,
state,
getters,
mutations,
actions
}