creatWebsite.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div :class="classObj" class="app-wrapper">
  3. <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
  4. <componentMenu :type="this.$store.state.template.menuType"/>
  5. <div :class="{hasTagsView:needTagsView}" class="main-container">
  6. <div :class="{'fixed-header':fixedHeader}">
  7. <navbar />
  8. <breadcrumb id="breadcrumb-container"/>
  9. </div>
  10. <app-main />
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. import RightPanel from '@/components/RightPanel'
  16. import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components'
  17. import ResizeMixin from './mixin/ResizeHandler'
  18. import { mapState } from 'vuex'
  19. import Breadcrumb from '@/components/Breadcrumb'
  20. import componentMenu from './components/template/componentMenu.vue'
  21. export default {
  22. name: 'Layout',
  23. components: {
  24. AppMain,
  25. Navbar,
  26. RightPanel,
  27. Settings,
  28. Sidebar,
  29. TagsView,
  30. Breadcrumb,
  31. componentMenu
  32. },
  33. mixins: [ResizeMixin],
  34. computed: {
  35. ...mapState({
  36. sidebar: state => state.app.sidebar,
  37. device: state => state.app.device,
  38. showSettings: state => state.settings.showSettings,
  39. needTagsView: state => state.settings.tagsView,
  40. fixedHeader: state => state.settings.fixedHeader
  41. }),
  42. classObj() {
  43. return {
  44. hideSidebar: !this.sidebar.opened,
  45. openSidebar: this.sidebar.opened,
  46. withoutAnimation: this.sidebar.withoutAnimation,
  47. mobile: this.device === 'mobile'
  48. }
  49. }
  50. },
  51. methods: {
  52. handleClickOutside() {
  53. this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. @import "~@/styles/mixin.scss";
  60. @import "~@/styles/variables.scss";
  61. .app-wrapper {
  62. @include clearfix;
  63. position: relative;
  64. height: 100%;
  65. width: 100%;
  66. &.mobile.openSidebar {
  67. position: fixed;
  68. top: 0;
  69. }
  70. }
  71. .drawer-bg {
  72. background: #000;
  73. opacity: 0.3;
  74. width: 100%;
  75. top: 0;
  76. height: 100%;
  77. position: absolute;
  78. z-index: 999;
  79. }
  80. .fixed-header {
  81. position: fixed;
  82. top: 0;
  83. right: 0;
  84. z-index: 9;
  85. width: calc(100% - #{$sideBarWidth});
  86. transition: width 0.28s;
  87. }
  88. .hideSidebar .fixed-header {
  89. width: calc(100% - 54px)
  90. }
  91. .mobile .fixed-header {
  92. width: 100%;
  93. }
  94. </style>