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

<script>
export default {
  name: 'app',
  provide() {
    return {
      reload: this.reload,
    }
  },
  data() {
    return {
      isRouterAlive: true,
    }
  },
  watch: {
    $route: {
      handler(to, from) {
        if (from) {
          this.$root.formPath = from.path
        }
      },
    },
  },
  mounted() {
    window.onpopstate = () => {
      if (!this.allowBack) {
        // 这个allowBack 是存在vuex里面的变量
        history.go(1)
      }
    }
  },
  methods: {
    reload() {
      this.isRouterAlive = false
      this.$nextTick(function () {
        this.isRouterAlive = true
      })
    },
  },
  computed: {},
}
</script>
<style lang="scss">
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.tox-tinymce-aux {
  z-index: 9999 !important;
}
</style>

<style lang="scss" scoped>
::v-deep {
  .el-tabs__item {
    font-size: 12px !important;
  }
}
</style>
