<template>
  <div id="app" v-cloak>
      <router-view  v-if="isRouterAlive"/>
  </div>
</template>

<script>
  import {_getStorage } from '@/utils/utils'
export default {
    name: 'App',
    data(){
      return {
        isRouterAlive:true,
        brandId:'',
      }
    },
    provide(){
      return{
        reload:this.reload
      }
    },
  watch:{
    $route(to,from){
      if(_getStorage('info')){
        let {brandId} = _getStorage('info')
        this.brandId = brandId
        this.init()
      }
    }
  },
    mounted() {

    },
    methods: {
      init(){
        this.$axios.get('/account/renovateBrand?brandId='+this.brandId).then(res=>{
          let {code,data} =res.data;
          if(code ==200){
            localStorage.setItem('priceformulaId',data.priceformulaId||null)
            localStorage.setItem('actSw',data.actSw)
            localStorage.setItem('allowCustomActDate',data.allowCustomActDate||null)
          }
        })
      },
      //切换品牌时，重新加载页面数据
        reload (){
          this.isRouterAlive = false
          this.$nextTick(function(){
              this.isRouterAlive = true
          })
        }
    }
}
</script>

<style lang="scss">
[v-cloak] {
      display: none;
    }
#app{
  height: 100%;
}
  // 基础样式
  @import './assets/styles/base';
</style>
<style>
  body::-webkit-scrollbar {
  /* display: none; */
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background-color: #fff;
  /* display: none; */
}
/*定义滚动条轨道 内阴影+圆角*/

::-webkit-scrollbar-track {
  /* // -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
  // border-radius: 10px; */
  background-color: #fff;
}
/*定义滑块 内阴影+圆角*/

::-webkit-scrollbar-thumb {
  /* // border-radius: 10px;
  // -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3); */
  background-color: #a9a9a9;
}
</style>
