Blame view

ant-design-vue-jeecg/src/App.vue 1.15 KB
肖超群 authored
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>
肖超群 authored
9
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
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
16
17
18
19
export default {
  data() {
    return {
      locale: zhCN,
    }
  },
  created() {
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
26
      this.$ls.set('language','en-US')
27
    }
肖超群 authored
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)
肖超群 authored
42
43
      }
肖超群 authored
44
    })
肖超群 authored
45
  }
肖超群 authored
46
}
肖超群 authored
47
48
</script>
<style>
肖超群 authored
49
50
51
#app {
  height: 100%;
}
肖超群 authored
52
</style>