<template>
  <div id="app" class="dm-reset">
    <router-view />
  </div>
</template>

<script>
import fetch from '@/api/performance.js';
const { getLogisticsCompany } = fetch;
export default {
  name: 'App',
  data() {
    return {
      isRouterAlive: true,
    };
  },
  mounted() {
    this.getLogisticsCompany();
    this.$store.commit('updateMainHeight', document.body.offsetHeight - 180);
  },
  methods: {
    async getLogisticsCompany() {
      let { result } = await getLogisticsCompany();
      this.$store.commit('setLogisticsCompany', result || []);
    }
  },
  watch: {
    '$route': {
      handler(val){
        // if(val.path.split('/')[1] !== 'compile' && this.$store.state.project !== 'compile' && this.$store.state.project && val.path.split('/')[1] !== this.$store.state.project) {
        //   // 切换应用 reload
        //   window.location.reload();
        // }
        if(val.path.split('/')[1]) {
          this.$store.commit('setProject', window.location.pathname.split('/')[2]);
        }
      },
      deep: true,
      immediate: true
    }
  }
};
</script>
