App.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <a-locale-provider :locale="locale">
  3. <div id="app">
  4. <router-view />
  5. </div>
  6. </a-locale-provider>
  7. </template>
  8. <script>
  9. import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
  10. import enquireScreen from '@/utils/device'
  11. export default {
  12. data() {
  13. return {
  14. locale: zhCN,
  15. }
  16. },
  17. created() {
  18. let that = this
  19. enquireScreen(deviceType => {
  20. // tablet
  21. if (deviceType === 0) {
  22. that.$store.commit('TOGGLE_DEVICE', 'mobile')
  23. that.$store.dispatch('setSidebar', false)
  24. }
  25. // mobile
  26. else if (deviceType === 1) {
  27. that.$store.commit('TOGGLE_DEVICE', 'mobile')
  28. that.$store.dispatch('setSidebar', false)
  29. } else {
  30. that.$store.commit('TOGGLE_DEVICE', 'desktop')
  31. that.$store.dispatch('setSidebar', true)
  32. }
  33. })
  34. }
  35. }
  36. </script>
  37. <style>
  38. #app {
  39. height: 100%;
  40. }
  41. body {
  42. -webkit-user-select: text !important;
  43. }
  44. * {
  45. -webkit-user-select: text !important;
  46. -moz-user-select: text !important;
  47. -ms-user-select: text !important;
  48. user-select: text !important;
  49. }
  50. </style>