halo-admin/src/App.vue

41 lines
947 B
Vue
Raw Normal View History

2019-03-18 16:35:13 +00:00
<template>
2019-03-20 12:22:52 +00:00
<a-locale-provider :locale="locale">
<div id="app" class="h-full">
2019-04-24 03:14:44 +00:00
<router-view />
2019-03-20 12:22:52 +00:00
</div>
</a-locale-provider>
2019-03-18 16:35:13 +00:00
</template>
2019-03-20 12:22:52 +00:00
<script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import { deviceEnquire, DEVICE_TYPE } from '@/utils/device'
export default {
data() {
2019-03-20 12:22:52 +00:00
return {
locale: zhCN
2019-03-18 16:35:13 +00:00
}
2019-03-20 12:22:52 +00:00
},
mounted() {
2019-03-20 12:22:52 +00:00
const { $store } = this
deviceEnquire(deviceType => {
switch (deviceType) {
case DEVICE_TYPE.DESKTOP:
$store.commit('TOGGLE_DEVICE', 'desktop')
$store.dispatch('setSidebar', true)
break
case DEVICE_TYPE.TABLET:
$store.commit('TOGGLE_DEVICE', 'tablet')
$store.dispatch('setSidebar', false)
break
case DEVICE_TYPE.MOBILE:
default:
$store.commit('TOGGLE_DEVICE', 'mobile')
$store.dispatch('setSidebar', true)
break
}
})
2019-03-18 16:35:13 +00:00
}
}
2019-03-20 12:22:52 +00:00
</script>