1- <template >
2- <a-locale-provider :locale =" locale" >
3- <div id =" app" >
4- <router-view />
5- </div >
6- </a-locale-provider >
7- </template >
8-
9- <script >
10- import zhCN from ' ant-design-vue/lib/locale-provider/zh_CN'
11- import { deviceEnquire , DEVICE_TYPE } from ' @/utils/device'
12- import { version } from ' ant-design-vue'
13-
14- export default {
15- data () {
16- return {
17- locale: zhCN,
18- version
19- }
20- },
21- mounted () {
22- const { $store } = this
23- console .log (' use Ant-Design Of Vue:' , version)
24- deviceEnquire (deviceType => {
25-
26- switch (deviceType) {
27- case DEVICE_TYPE .DESKTOP :
28- $store .commit (' TOGGLE_DEVICE' , ' desktop' )
29- $store .dispatch (' setSidebar' , true )
30- break
31- case DEVICE_TYPE .TABLET :
32- console .log (' tablet' )
33- $store .dispatch (' ToggleDevice' , ' tablet' )
34- $store .dispatch (' setSidebar' , false )
35- break
36- case DEVICE_TYPE .MOBILE :
37- default :
38- $store .commit (' TOGGLE_DEVICE' , ' mobile' )
39- $store .dispatch (' setSidebar' , false )
40- break
41- }
42- console .log (' deviceType' , deviceType)
43- })
44- }
45- }
46- </script >
47- <style >
48- #app {
49- height : 100% ;
50- }
1+ <template >
2+ <a-locale-provider :locale =" locale" >
3+ <div id =" app" >
4+ <router-view />
5+ </div >
6+ </a-locale-provider >
7+ </template >
8+
9+ <script >
10+ import zhCN from ' ant-design-vue/lib/locale-provider/zh_CN'
11+ import { deviceEnquire , DEVICE_TYPE } from ' @/utils/device'
12+
13+ export default {
14+ data () {
15+ return {
16+ locale: zhCN
17+ }
18+ },
19+ mounted () {
20+ const { $store } = this
21+ deviceEnquire (deviceType => {
22+
23+ switch (deviceType) {
24+ case DEVICE_TYPE .DESKTOP :
25+ $store .commit (' TOGGLE_DEVICE' , ' desktop' )
26+ $store .dispatch (' setSidebar' , true )
27+ break
28+ case DEVICE_TYPE .TABLET :
29+ $store .commit (' TOGGLE_DEVICE' , ' tablet' )
30+ $store .dispatch (' setSidebar' , false )
31+ break
32+ case DEVICE_TYPE .MOBILE :
33+ default :
34+ $store .commit (' TOGGLE_DEVICE' , ' mobile' )
35+ $store .dispatch (' setSidebar' , true )
36+ break
37+ }
38+ console .log (' deviceType' , deviceType)
39+ })
40+ }
41+ }
42+ </script >
43+ <style >
44+ #app {
45+ height : 100% ;
46+ }
5147 </style >
0 commit comments