陶杰
2024-08-22 973662aeae3e7c788c14671d17c5962395141770
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<template>
  <div class="back-layout">
    <div
      v-if="isMobile && !menuShrink"
      class="back-layout__backdrop"
      @click="onBackdropClick"
    />
    <base-sidebar></base-sidebar>
    <div class="back-layout__right">
      <base-nav></base-nav>
      <tags-view v-if="enableTagView"></tags-view>
      <div class="back-layout__main">
        <nuxt />
      </div>
    </div>
  </div>
</template>
 
<script>
import { mapState } from 'vuex'
import TagsView from '@/components/tags-view'
export default {
  components: {
    TagsView,
  },
  middleware: ['auth', 'permission'],
  data() {
    return {
      enableTagView: this.$config.enableTagView,
    }
  },
  computed: {
    ...mapState({
      isMobile: (state) => state.app.isMobile,
      menuShrink: (state) => state.app.menuShrink,
    }),
  },
  methods: {
    onBackdropClick() {
      this.$store.commit('app/SET_MENU_SHRINK', true)
    },
  },
}
</script>
 
<style scoped lang="scss">
.back-layout {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  &__backdrop {
    background-color: rgba(0, 0, 0, 0.3);
    width: 100%;
    top: 0;
    height: 100%;
    position: absolute;
    z-index: 999;
  }
  &__right {
    flex: 1;
    height: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
  }
  &__main {
    flex: 1;
    background-color: #ebf2f9;
    overflow: auto;
    padding: 20px;
  }
}
</style>