|
1
2
3
4
5
6
7
8
|
<template>
<a-config-provider :locale="locale">
<div id="app">
<router-view/>
</div>
</a-config-provider>
</template>
<script>
|
|
9
|
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
|
谭毅彬
authored
|
10
|
import enUS from 'ant-design-vue/lib/locale-provider/en_US'
|
|
11
|
import enquireScreen from '@/utils/device'
|
|
12
|
|
|
13
14
15
16
17
18
19
|
export default {
data() {
return {
locale: zhCN,
}
},
created() {
|
谭毅彬
authored
|
20
21
22
23
24
25
|
let language = this.$ls.get('language')
if ('zh-CN' == language) {
this.locale = zhCN
this.$ls.set('language','zh-CN')
} else {
this.locale = enUS
|
谭毅彬
authored
|
26
|
this.$ls.set('language','en-US')
|
谭毅彬
authored
|
27
|
}
|
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
let that = this
enquireScreen(deviceType => {
// tablet
if (deviceType === 0) {
that.$store.commit('TOGGLE_DEVICE', 'mobile')
that.$store.dispatch('setSidebar', false)
}
// mobile
else if (deviceType === 1) {
that.$store.commit('TOGGLE_DEVICE', 'mobile')
that.$store.dispatch('setSidebar', false)
} else {
that.$store.commit('TOGGLE_DEVICE', 'desktop')
that.$store.dispatch('setSidebar', true)
|
|
42
43
|
}
|
|
44
|
})
|
|
45
|
}
|
|
46
|
}
|
|
47
48
|
</script>
<style>
|
|
49
50
51
|
#app {
height: 100%;
}
|
|
52
|
</style>
|