<!--
 * @Descripttion:
 * @version:
 * @Author: Wiley.Yang
 * @Date: 2022-02-11 17:24:06
 * @LastEditors: Wiley.Yang
 * @LastEditTime: 2022-02-16 15:50:56
-->
<template>
  <div id="app">
    <router-view v-if="isRouterAlive" />
  </div>
</template>

<script>
import {
  // getToken,
  setToken
} from '@/utils/auth' // get token from cookie
import qs from 'qs'

export default {
  name: 'App',
  provide() {
    return {
      reload: this.reload
    }
  },
  data() {
    return {
      isRouterAlive: true
    }
  },
  created() {
    if (window.location.search != null && window.location.search !== '') {
      var tokenObj = qs.parse(window.location.search.substr(1))
      console.log(tokenObj);
      if (tokenObj.token != null && tokenObj.token !== '') {
        setToken(tokenObj.token)
        if (tokenObj.redirect != null) {
          window.location.href = './#' + tokenObj.redirect
        } else {
          window.location.href = './'
        }
      }
    }
  },
  methods: {
    reload() {
      this.isRouterAlive = false
      this.$nextTick(() => {
        this.isRouterAlive = true
      })
    }
  }
}
</script>
<style>
火狐浏览器滚动条 * {
  /* 滑块颜色  滚动条背景颜色 */
  scrollbar-color: rgba(17, 170, 255, 0.6) rgba(17, 170, 255, 0.1);
  /* 滚动条宽度有三种：thin、auto、none */
  scrollbar-width: none;
}
</style>
