AppMain.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <section class="app-main">
  3. <transition name="fade-transform" mode="out-in">
  4. <keep-alive :include="cachedViews">
  5. <router-view v-if="!$route.meta.link" :key="key" />
  6. </keep-alive>
  7. </transition>
  8. <iframe-toggle />
  9. </section>
  10. </template>
  11. <script>
  12. import iframeToggle from "./IframeToggle/index"
  13. export default {
  14. name: 'AppMain',
  15. components: { iframeToggle },
  16. computed: {
  17. cachedViews() {
  18. return this.$store.state.tagsView.cachedViews
  19. },
  20. key() {
  21. return this.$route.path
  22. }
  23. },
  24. watch: {
  25. $route() {
  26. this.addIframe()
  27. }
  28. },
  29. mounted() {
  30. this.addIframe()
  31. },
  32. methods: {
  33. addIframe() {
  34. const {name} = this.$route
  35. if (name && this.$route.meta.link) {
  36. this.$store.dispatch('tagsView/addIframeView', this.$route)
  37. }
  38. }
  39. }
  40. }
  41. </script>
  42. <style lang="scss" scoped>
  43. .app-main {
  44. /* 50= navbar 50 */
  45. min-height: calc(100vh - 50px);
  46. width: 100%;
  47. position: relative;
  48. overflow: hidden;
  49. }
  50. .fixed-header + .app-main {
  51. padding-top: 50px;
  52. }
  53. .hasTagsView {
  54. .app-main {
  55. /* 84 = navbar + tags-view = 50 + 34 */
  56. min-height: calc(100vh - 84px);
  57. }
  58. .fixed-header + .app-main {
  59. padding-top: 84px;
  60. }
  61. }
  62. </style>
  63. <style lang="scss">
  64. // fix css style bug in open el-dialog
  65. .el-popup-parent--hidden {
  66. .fixed-header {
  67. padding-right: 6px;
  68. }
  69. }
  70. ::-webkit-scrollbar {
  71. width: 6px;
  72. height: 6px;
  73. }
  74. ::-webkit-scrollbar-track {
  75. background-color: #f1f1f1;
  76. }
  77. ::-webkit-scrollbar-thumb {
  78. background-color: #c0c0c0;
  79. border-radius: 3px;
  80. }
  81. </style>