Layout.vue 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <div class="app-wrapper" :class="classObj">
  3. <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"></div>
  4. <navbar></navbar>
  5. <div class="Header-container">
  6. <sidebar class="sidebar-container"></sidebar>
  7. <div class="main-container">
  8. <tags-view></tags-view>
  9. <app-main></app-main>
  10. <contact-box></contact-box>
  11. </div>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. import { Navbar, Sidebar, AppMain, TagsView } from './components'
  17. import ContactBox from '@/scrm_pages/contactBox';
  18. import ResizeMixin from './mixin/ResizeHandler'
  19. export default {
  20. name: 'layout',
  21. components: {
  22. Navbar,
  23. Sidebar,
  24. AppMain,
  25. TagsView,
  26. ContactBox,
  27. },
  28. mixins: [ResizeMixin],
  29. computed: {
  30. sidebar() {
  31. return this.$store.state.app.sidebar
  32. },
  33. device() {
  34. return this.$store.state.app.device
  35. },
  36. classObj() {
  37. return {
  38. hideSidebar: !this.sidebar.opened,
  39. openSidebar: this.sidebar.opened,
  40. withoutAnimation: this.sidebar.withoutAnimation,
  41. mobile: this.device === 'mobile'
  42. }
  43. }
  44. },
  45. methods: {
  46. handleClickOutside() {
  47. this.$store.dispatch('closeSideBar', { withoutAnimation: false })
  48. }
  49. }
  50. }
  51. </script>
  52. <style rel="stylesheet/scss" lang="scss" scoped>
  53. @import "src/styles/mixin.scss";
  54. .app-wrapper {
  55. @include clearfix;
  56. // position: relative;
  57. height: 100%;
  58. width: 100%;
  59. // &.mobile.openSidebar{
  60. // position: fixed;
  61. // top: 0;
  62. // }
  63. }
  64. .drawer-bg {
  65. background: #000;
  66. opacity: 0.3;
  67. width: 100%;
  68. top: 0;
  69. height: 100%;
  70. position: absolute;
  71. z-index: 999;
  72. }
  73. </style>