App.vue 997 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <div id="app">
  3. <router-view v-if="isRouterAlive" />
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: 'app',
  9. provide() {
  10. return {
  11. reload: this.reload,
  12. }
  13. },
  14. data() {
  15. return {
  16. isRouterAlive: true,
  17. }
  18. },
  19. watch: {
  20. $route: {
  21. handler(to, from) {
  22. if (from) {
  23. this.$root.formPath = from.path
  24. }
  25. },
  26. },
  27. },
  28. mounted() {
  29. window.onpopstate = () => {
  30. if (!this.allowBack) {
  31. // 这个allowBack 是存在vuex里面的变量
  32. history.go(1)
  33. }
  34. }
  35. },
  36. methods: {
  37. reload() {
  38. this.isRouterAlive = false
  39. this.$nextTick(function () {
  40. this.isRouterAlive = true
  41. })
  42. },
  43. },
  44. computed: {},
  45. }
  46. </script>
  47. <style lang="scss">
  48. #app {
  49. width: 100%;
  50. height: 100%;
  51. overflow: hidden;
  52. }
  53. .tox-tinymce-aux {
  54. z-index: 9999 !important;
  55. }
  56. </style>
  57. <style lang="scss" scoped>
  58. ::v-deep {
  59. .el-tabs__item {
  60. font-size: 12px !important;
  61. }
  62. }
  63. </style>