AppMain.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <section class="app-main">
  3. <!-- -->
  4. <transition name="fade-transform" mode="out-in">
  5. <div>
  6. <keep-alive >
  7. <router-view :key="key" v-if="needKeep" />
  8. </keep-alive>
  9. <router-view v-if="!needKeep" :key="key" />
  10. </div>
  11. </transition>
  12. </section>
  13. </template>
  14. <script>
  15. import notKeepAliveList from "@/router/notKeepAliveList";
  16. export default {
  17. name: "AppMain",
  18. computed: {
  19. key() {
  20. return this.$route.path;
  21. },
  22. needKeep() {
  23. return !notKeepAliveList.includes(this.$route.path);
  24. },
  25. cachedViews() {
  26. return this.$store.state.tagsView.cachedViews;
  27. },
  28. keep() {
  29. return this.$route.meta.noCache;
  30. },
  31. },
  32. };
  33. </script>
  34. <style scoped>
  35. .app-main {
  36. /*50 = navbar */
  37. /* height: calc(100vh - 80px); */
  38. /* height: 100vh; */
  39. padding-top: 80px;
  40. /* min-width: 1440px; */
  41. position: relative;
  42. /* overflow: auto; */
  43. box-sizing: border-box;
  44. margin-left: 10px;
  45. margin-top: 20px;
  46. }
  47. .fixed-header + .app-main {
  48. padding-top: 80px;
  49. }
  50. </style>
  51. <style lang="scss">
  52. // fix css style bug in open el-dialog
  53. .el-popup-parent--hidden {
  54. .fixed-header {
  55. padding-right: 15px;
  56. }
  57. }
  58. </style>