Sign in

徐烜 / bsth-ebus-h5_editor · Files

GitLab

  • Go to dashboard
  • Project
  • Activity
  • Files
  • Commits
  • Builds 0
  • Network
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • bsth-ebus-h5_editor
  • front-end
  • h5
  • src
  • store
  • modules
  • i18n.js
  • feat(i18n) setup i18n config
    90d0b6a4
    ly525 authored
    2019-09-17 01:04:20 +0800  
    Browse Code »
i18n.js 434 Bytes
Edit Raw Blame History
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
import { loadLanguageAsync } from '@/locales'

const i18n = {
  namespaced: true,
  state: {
    lang: 'zh-CN'
  },
  mutations: {
    SET_LANG: (state, lang) => {
      state.lang = lang
    }
  },
  actions: {
    // 设置界面语言
    SetLang ({ commit }, lang) {
      return new Promise(resolve => {
        commit('SET_LANG', lang)
        loadLanguageAsync(lang)
        resolve()
      })
    }
  }
}

export default i18n