App.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <a-config-provider :locale="locale">
  3. <div id="app">
  4. <router-view/>
  5. </div>
  6. </a-config-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. var link = document.querySelector('link[rel*="icon"]')
  19. link.href = '../'+process.env.VUE_APP_PLATFORM_LOGO
  20. document.title =process.env.VUE_APP_PLATFORM_TITLE
  21. let that = this
  22. enquireScreen(deviceType => {
  23. // tablet
  24. if (deviceType === 0) {
  25. that.$store.commit('TOGGLE_DEVICE', 'mobile')
  26. that.$store.dispatch('setSidebar', false)
  27. }
  28. // mobile
  29. else if (deviceType === 1) {
  30. that.$store.commit('TOGGLE_DEVICE', 'mobile')
  31. that.$store.dispatch('setSidebar', false)
  32. }
  33. else {
  34. that.$store.commit('TOGGLE_DEVICE', 'desktop')
  35. that.$store.dispatch('setSidebar', true)
  36. }
  37. })
  38. },
  39. mounted() {// netdisk add by nbacheng
  40. const that = this
  41. window.addEventListener('resize', function () {
  42. return (() => {
  43. that.$store.commit('changeScreenWidth', document.body.clientWidth)
  44. })()
  45. })
  46. }
  47. }
  48. </script>
  49. <style>
  50. #app {
  51. height: 100%;
  52. }
  53. </style>