creatWebsite.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. <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. export default {
  21. name: 'Layout',
  22. components: {
  23. AppMain,
  24. Navbar,
  25. RightPanel,
  26. Settings,
  27. Sidebar,
  28. TagsView,
  29. Breadcrumb
  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" scoped>
  57. @import "~@/styles/mixin.scss";
  58. @import "~@/styles/variables.scss";
  59. .app-wrapper {
  60. @include clearfix;
  61. position: relative;
  62. height: 100%;
  63. width: 100%;
  64. &.mobile.openSidebar {
  65. position: fixed;
  66. top: 0;
  67. }
  68. }
  69. .drawer-bg {
  70. background: #000;
  71. opacity: 0.3;
  72. width: 100%;
  73. top: 0;
  74. height: 100%;
  75. position: absolute;
  76. z-index: 999;
  77. }
  78. .fixed-header {
  79. position: fixed;
  80. top: 0;
  81. right: 0;
  82. z-index: 9;
  83. width: calc(100% - #{$sideBarWidth});
  84. transition: width 0.28s;
  85. }
  86. .hideSidebar .fixed-header {
  87. width: calc(100% - 54px)
  88. }
  89. .mobile .fixed-header {
  90. width: 100%;
  91. }
  92. </style>