新增:增加国际化语言支持;

This commit is contained in:
iczer 2020-06-23 14:19:42 +08:00
parent 98bc9b2386
commit 198b1e2ab5
4 changed files with 27 additions and 3 deletions

View File

@ -23,6 +23,7 @@
"pouchdb": "^7.2.1", "pouchdb": "^7.2.1",
"viser-vue": "^2.4.8", "viser-vue": "^2.4.8",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-i18n": "^8.18.2",
"vue-router": "^3.3.4", "vue-router": "^3.3.4",
"vuedraggable": "^2.23.2", "vuedraggable": "^2.23.2",
"vuex": "^3.4.0" "vuex": "^3.4.0"
@ -34,6 +35,7 @@
"@vue/cli-service": "^4.4.0", "@vue/cli-service": "^4.4.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"deepmerge": "^4.2.2",
"eslint": "^6.7.2", "eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
"gh-pages": "^3.1.0", "gh-pages": "^3.1.0",

View File

@ -22,10 +22,13 @@ export default {
watch: { watch: {
weekMode(val) { weekMode(val) {
this.setWeekModeTheme(val) this.setWeekModeTheme(val)
},
lang(val) {
this.$i18n.locale = val
} }
}, },
computed: { computed: {
...mapState('setting', ['weekMode']) ...mapState('setting', ['weekMode', 'lang'])
}, },
methods: { methods: {
setWeekModeTheme(weekMode) { setWeekModeTheme(weekMode) {

View File

@ -9,20 +9,29 @@ import '@/mock'
import store from './store' import store from './store'
import PouchDB from 'pouchdb' import PouchDB from 'pouchdb'
import 'animate.css/source/animate.css' import 'animate.css/source/animate.css'
import VueI18n from 'vue-i18n'
Vue.prototype.$axios = axios Vue.prototype.$axios = axios
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(Viser) Vue.use(Viser)
Vue.use(Antd) Vue.use(Antd)
Vue.use(VueI18n)
const i18n = new VueI18n({
locale: 'CN',
fallbackLocale: 'US',
silentFallbackWarn: true
})
new Vue({ new Vue({
router, router,
store, store,
i18n,
render: h => h(App), render: h => h(App),
mounted () { mounted () {
var db = new PouchDB('admindb') let db = new PouchDB('adminDb')
db.get('currUser').then(doc => { db.get('currUser').then(doc => {
this.$store.commit('account/setuser', doc.user) this.$store.commit('account/setUser', doc.user)
}) })
}, },
}).$mount('#app') }).$mount('#app')

View File

@ -3360,6 +3360,11 @@ deepmerge@^1.5.2:
resolved "https://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.2.tgz?cache=0&sync_timestamp=1572279720382&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdeepmerge%2Fdownload%2Fdeepmerge-1.5.2.tgz#10499d868844cdad4fee0842df8c7f6f0c95a753" resolved "https://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.2.tgz?cache=0&sync_timestamp=1572279720382&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdeepmerge%2Fdownload%2Fdeepmerge-1.5.2.tgz#10499d868844cdad4fee0842df8c7f6f0c95a753"
integrity sha1-EEmdhohEza1P7ghC34x/bwyVp1M= integrity sha1-EEmdhohEza1P7ghC34x/bwyVp1M=
deepmerge@^4.2.2:
version "4.2.2"
resolved "https://registry.npm.taobao.org/deepmerge/download/deepmerge-4.2.2.tgz?cache=0&sync_timestamp=1572279720382&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdeepmerge%2Fdownload%2Fdeepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955"
integrity sha1-RNLqNnm49NT/ujPwPYZfwee/SVU=
default-gateway@^4.2.0: default-gateway@^4.2.0:
version "4.2.0" version "4.2.0"
resolved "https://registry.npm.taobao.org/default-gateway/download/default-gateway-4.2.0.tgz?cache=0&sync_timestamp=1590419212936&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdefault-gateway%2Fdownload%2Fdefault-gateway-4.2.0.tgz#167104c7500c2115f6dd69b0a536bb8ed720552b" resolved "https://registry.npm.taobao.org/default-gateway/download/default-gateway-4.2.0.tgz?cache=0&sync_timestamp=1590419212936&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdefault-gateway%2Fdownload%2Fdefault-gateway-4.2.0.tgz#167104c7500c2115f6dd69b0a536bb8ed720552b"
@ -9277,6 +9282,11 @@ vue-hot-reload-api@^2.3.0:
resolved "https://registry.npm.taobao.org/vue-hot-reload-api/download/vue-hot-reload-api-2.3.4.tgz#532955cc1eb208a3d990b3a9f9a70574657e08f2" resolved "https://registry.npm.taobao.org/vue-hot-reload-api/download/vue-hot-reload-api-2.3.4.tgz#532955cc1eb208a3d990b3a9f9a70574657e08f2"
integrity sha1-UylVzB6yCKPZkLOp+acFdGV+CPI= integrity sha1-UylVzB6yCKPZkLOp+acFdGV+CPI=
vue-i18n@^8.18.2:
version "8.18.2"
resolved "https://registry.npm.taobao.org/vue-i18n/download/vue-i18n-8.18.2.tgz#cd7c12f2e178e6faa23b0e3cfd2f7bac9305f8fc"
integrity sha1-zXwS8uF45vqiOw48/S97rJMF+Pw=
vue-loader@^15.9.2: vue-loader@^15.9.2:
version "15.9.2" version "15.9.2"
resolved "https://registry.npm.taobao.org/vue-loader/download/vue-loader-15.9.2.tgz#ae01f5f4c9c6a04bff4483912e72ef91a402c1ae" resolved "https://registry.npm.taobao.org/vue-loader/download/vue-loader-15.9.2.tgz#ae01f5f4c9c6a04bff4483912e72ef91a402c1ae"