default.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <div :class="classObj" class="app-wrapper">
  3. <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
  4. <Sidebar class="sidebar-container" />
  5. <div :class="{hasTagsView:needTagsView}" class="main-container">
  6. <div :class="{'fixed-header':fixedHeader}">
  7. <Navbar />
  8. <!-- <tags-view v-if="needTagsView" /> -->
  9. </div>
  10. <AppMain />
  11. <!-- <nuxt /> -->
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import RightPanel from "@/components/RightPanel";
  17. import {
  18. AppMain,
  19. Navbar,
  20. Settings,
  21. Sidebar,
  22. TagsView
  23. } from "./components/index";
  24. import { mapState } from "vuex";
  25. // import "../styles/index.scss"; // global css
  26. export default {
  27. name: "Layout",
  28. components: {
  29. AppMain,
  30. Navbar,
  31. RightPanel,
  32. Settings,
  33. Sidebar,
  34. TagsView
  35. },
  36. mixins: [],
  37. computed: {
  38. ...mapState({
  39. sidebar: state => state.app.sidebar,
  40. device: state => state.app.device,
  41. showSettings: state => state.settings.showSettings,
  42. needTagsView: state => state.settings.tagsView,
  43. fixedHeader: state => state.settings.fixedHeader
  44. }),
  45. classObj() {
  46. return {
  47. hideSidebar: !this.sidebar.opened,
  48. openSidebar: this.sidebar.opened,
  49. withoutAnimation: this.sidebar.withoutAnimation,
  50. mobile: this.device === "mobile"
  51. };
  52. }
  53. },
  54. methods: {
  55. handleClickOutside() {
  56. this.$store.dispatch("app/closeSideBar", { withoutAnimation: false });
  57. }
  58. }
  59. };
  60. </script>
  61. <style lang="scss">
  62. @import "~@/styles/mixin.scss";
  63. @import "~@/styles/variables.scss";
  64. @import "~@/styles/index.scss";
  65. html {
  66. font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI",
  67. Roboto, "Helvetica Neue", Arial, sans-serif;
  68. font-size: 16px;
  69. word-spacing: 1px;
  70. -ms-text-size-adjust: 100%;
  71. -webkit-text-size-adjust: 100%;
  72. -moz-osx-font-smoothing: grayscale;
  73. -webkit-font-smoothing: antialiased;
  74. box-sizing: border-box;
  75. }
  76. *,
  77. *:before,
  78. *:after {
  79. box-sizing: border-box;
  80. margin: 0;
  81. }
  82. .button--green {
  83. display: inline-block;
  84. border-radius: 4px;
  85. border: 1px solid #3b8070;
  86. color: #3b8070;
  87. text-decoration: none;
  88. padding: 10px 30px;
  89. }
  90. .button--green:hover {
  91. color: #fff;
  92. background-color: #3b8070;
  93. }
  94. .button--grey {
  95. display: inline-block;
  96. border-radius: 4px;
  97. border: 1px solid #35495e;
  98. color: #35495e;
  99. text-decoration: none;
  100. padding: 10px 30px;
  101. margin-left: 15px;
  102. }
  103. .button--grey:hover {
  104. color: #fff;
  105. background-color: #35495e;
  106. }
  107. .app-wrapper {
  108. @include clearfix;
  109. position: relative;
  110. height: 100%;
  111. width: 100%;
  112. &.mobile.openSidebar {
  113. position: fixed;
  114. top: 0;
  115. }
  116. }
  117. .drawer-bg {
  118. background: #000;
  119. opacity: 0.3;
  120. width: 100%;
  121. top: 0;
  122. height: 100%;
  123. position: absolute;
  124. z-index: 999;
  125. }
  126. .fixed-header {
  127. position: fixed;
  128. top: 0;
  129. right: 0;
  130. z-index: 9;
  131. width: calc(100% - #{$sideBarWidth});
  132. transition: width 0.28s;
  133. }
  134. .hideSidebar .fixed-header {
  135. width: calc(100% - 54px);
  136. }
  137. .mobile .fixed-header {
  138. width: 100%;
  139. }
  140. </style>