'增加国际化'

This commit is contained in:
caoyang
2022-01-11 23:11:08 +08:00
parent f269ee11cb
commit a2b8487cfc
20 changed files with 939 additions and 428 deletions
+35 -1
View File
@@ -1,18 +1,29 @@
<template>
<a-config-provider :locale="locale">
<div id="app">
<div>
<a-button @click="changeLocale('en-us')" v-show="localeval=='zh-cn'">English</a-button >
<a-button @click="changeLocale('zh-cn')" v-show="localeval=='en-us'">中文</a-button >
</div>
<router-view/>
</div>
</a-config-provider>
</template>
<script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
// import en from 'ant-design-vue/lib/locale-provider/en_US'
import enquireScreen from '@/utils/device'
import moment from 'moment'
import 'moment/locale/zh-cn'
moment.locale('zh-cn')
const EN = 'en-us'
const ZH = 'zh-cn'
export default {
data () {
return {
locale: zhCN,
localeval: 'zh-cn'
}
},
created () {
@@ -32,8 +43,31 @@
that.$store.commit('TOGGLE_DEVICE', 'desktop')
that.$store.dispatch('setSidebar', true)
}
})
},
mounted() {
},
watch:{
},
computed:{
},
methods:{
moment,
changeLocale (localeval) {
this.localeval = localeval
if (localeval === EN) {
moment.locale(EN)
this.$i18n.locale = EN
this.locale = null
} else {
moment.locale(ZH)
this.$i18n.locale = ZH
this.locale = zhCN
}
}
}
}
</script>