<template>
  <a-config-provider :locale="locale">
    <div id="app">
      <router-view/>
    </div>
  </a-config-provider>
</template>
<script>
  import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
  import enquireScreen from '@/utils/device'

  export default {
    data () {
      return {
        locale: zhCN,
      }
    },
    created () {
      var link = document.querySelector('link[rel*="icon"]') 
      link.href = '../'+process.env.VUE_APP_PLATFORM_LOGO
      document.title =process.env.VUE_APP_PLATFORM_TITLE
      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)
        }

      })
    },
    mounted() {// netdisk add by nbacheng 
    	const that = this
    	window.addEventListener('resize', function () {
    		return (() => {
    			that.$store.commit('changeScreenWidth', document.body.clientWidth)
    		})()
    	})
    }  
  }
</script>
<style>
  #app {
    height: 100%;
  }
</style>