default.vue 3.0 KB

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