App.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div id="app">
  3. <v-tour name="myTour" :steps="steps" :options="myOptions" :callbacks="myCallbacks" v-if="tourFlg"></v-tour>
  4. <transition name="fade" mode="out-in">
  5. <!-- <keep-alive>
  6. <router-view v-if='$route.meta != null && $route.meta.keepAlive'/>
  7. </keep-alive> -->
  8. <router-view v-if="isRouterAlive"/>
  9. </transition>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'app',
  15. components: {},
  16. //父组件中返回要传给下级的数据
  17. provide() {
  18. return {
  19. reloads: this.reloads,
  20. }
  21. },
  22. data(){
  23. return{
  24. isRouterAlive:true,
  25. firstTourFalse: false
  26. }
  27. },
  28. mounted() {
  29. this.firstTourFalse = localStorage.getItem('firstTourFalse') | true
  30. // 监听页面刷新事件
  31. window.addEventListener('unload', this.setItemFirstTourFalse)
  32. },
  33. methods:{
  34. setItemFirstTourFalse() {
  35. localStorage.setItem('firstTourFalse', firstTourFalse)
  36. },
  37. reloads(){
  38. this.isRouterAlive = false
  39. this.$nextTick(() => {
  40. this.isRouterAlive = true
  41. })
  42. }
  43. }
  44. }
  45. </script>
  46. <style>
  47. .v-tour__target--highlighted {
  48. box-shadow: 0 0 0 99999px rgba(0,0,0,.4) !important;
  49. }
  50. </style>
  51. <style lang="scss">
  52. body {
  53. margin: 0px;
  54. padding: 0px;
  55. font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
  56. font-size: 14px;
  57. -webkit-font-smoothing: antialiased;
  58. }
  59. #app {
  60. position: absolute;
  61. top: 0px;
  62. bottom: 0px;
  63. width: 100%;
  64. }
  65. .el-submenu [class^=fa] {
  66. vertical-align: baseline;
  67. margin-right: 10px;
  68. }
  69. .el-menu-item [class^=fa] {
  70. vertical-align: baseline;
  71. margin-right: 10px;
  72. }
  73. .toolbar {
  74. background: #f2f2f2;
  75. padding: 10px;
  76. .el-form-item {
  77. margin-bottom: 10px;
  78. }
  79. }
  80. .fade-enter-active,
  81. .fade-leave-active {
  82. transition: all .2s ease;
  83. }
  84. .fade-enter,
  85. .fade-leave-active {
  86. opacity: 0;
  87. }
  88. </style>