Blame view

ant-design-vue-jeecg/src/App.vue 1.15 KB
肖超群 authored
1
2
3
<template>
  <a-config-provider :locale="locale">
    <div id="app">
谭毅彬 authored
4
      <router-view />
肖超群 authored
5
6
7
8
    </div>
  </a-config-provider>
</template>
<script>
肖超群 authored
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'
肖超群 authored
11
import enquireScreen from '@/utils/device'
肖超群 authored
12
肖超群 authored
13
14
15
export default {
  data() {
    return {
谭毅彬 authored
16
      locale: enUS
肖超群 authored
17
18
19
    }
  },
  created() {
谭毅彬 authored
20
21
22
23
24
25
26
    //获取本地缓存中的语言配置,并切换
    let language = this.$ls.get('language')
    if (language == 'zh-CN') {
      this.locale = zhCN
    } else if (language == 'en-US') {
      this.locale = enUS
    }
肖超群 authored
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    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)
肖超群 authored
41
      }
肖超群 authored
42
    })
肖超群 authored
43
  }
肖超群 authored
44
}
肖超群 authored
45
46
</script>
<style>
肖超群 authored
47
48
49
#app {
  height: 100%;
}
肖超群 authored
50
</style>