Layout.vue 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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" @callBackIndex="handleIndex"></sidebar>
  7. <div class="main-container">
  8. <tags-view :index="index"></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. data(){
  46. return{
  47. index: 0,
  48. }
  49. },
  50. methods: {
  51. handleClickOutside() {
  52. this.$store.dispatch('closeSideBar', { withoutAnimation: false })
  53. },
  54. handleIndex(data) {
  55. // console.log({ prop: data });
  56. this.index = data;
  57. }
  58. }
  59. }
  60. </script>
  61. <style rel="stylesheet/scss" lang="scss" scoped>
  62. @import "src/styles/mixin.scss";
  63. .app-wrapper {
  64. @include clearfix;
  65. // position: relative;
  66. height: 100%;
  67. width: 100%;
  68. // &.mobile.openSidebar{
  69. // position: fixed;
  70. // top: 0;
  71. // }
  72. }
  73. .drawer-bg {
  74. background: #000;
  75. opacity: 0.3;
  76. width: 100%;
  77. top: 0;
  78. height: 100%;
  79. position: absolute;
  80. z-index: 999;
  81. }
  82. </style>