yangys
2025-05-27 81060ec4cc3ead9080d4bdb3875920e257583de4
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<template>
  <el-button
    @click="show = true"
    class="setting-icon"
    type="primary"
    icon="el-icon-setting"
    circle
  ></el-button>
  <el-drawer append-to-body :with-header="false" v-model="show" size="30%">
    <div class="setting">
      <h5>导航模式</h5>
      <div class="setting-checkbox">
        <el-tooltip class="item" effect="dark" content="侧边菜单布局" placement="top">
          <div
            @click="setting.sidebar = 'vertical'"
            class="setting-checkbox-item setting-checkbox-item--side"
          ></div>
        </el-tooltip>
        <el-tooltip class="item" effect="dark" content="顶部菜单布局" placement="top">
          <div
            @click="setting.sidebar = 'horizontal'"
            class="setting-checkbox-item setting-checkbox-item--top"
          ></div>
        </el-tooltip>
      </div>
      <h5>页面布局</h5>
      <div class="setting-checkbox">
        <div class="setting-item" v-for="(item, index) in list1" :key="index">
          {{ item.label }}:
          <el-switch v-model="setting[item.value]"></el-switch>
        </div>
      </div>
      <h5>功能调试</h5>
      <div class="setting-checkbox">
        <div class="setting-item" v-for="(item, index) in list2" :key="index">
          {{ item.label }}:
          <el-switch v-model="setting[item.value]"></el-switch>
        </div>
      </div>
    </div>
  </el-drawer>
</template>
 
<script>
import { mapGetters } from 'vuex';
 
export default {
  data() {
    return {
      show: false,
      list1: [
        {
          label: '导航标签',
          value: 'tag',
        },
        {
          label: '菜单折叠',
          value: 'collapse',
        },
        {
          label: '菜单搜索',
          value: 'search',
        },
        {
          label: '屏幕全屏',
          value: 'fullscreen',
        },
        {
          label: '主题选择',
          value: 'theme',
        },
        {
          label: '顶部菜单',
          value: 'menu',
        },
      ],
      list2: [
        {
          label: '日志调试',
          value: 'debug',
        },
        {
          label: '屏幕锁定',
          value: 'lock',
        },
      ],
    };
  },
  computed: {
    ...mapGetters(['isHorizontal', 'setting']),
  },
};
</script>
 
<style lang="scss">
.setting {
  &-icon {
    color: #666;
    position: fixed;
    bottom: 200px;
    right: 20px;
    z-index: 2048;
  }
 
  &-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 8px;
  }
 
  &-checkbox {
    &--check {
      position: absolute;
      color: var(--el-color-primary);
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
    }
 
    &-item {
      display: inline-block;
      position: relative;
      width: 44px;
      height: 36px;
      margin-right: 16px;
      overflow: hidden;
      background-color: #f0f2f5;
      border-radius: 4px;
      box-shadow: 0 1px 2.5px 0 rgba(0, 0, 0, 0.18);
      cursor: pointer;
 
      &:before {
        position: absolute;
        top: 0;
        left: 0;
        width: 33%;
        height: 100%;
        background-color: #fff;
        content: '';
      }
 
      &:after {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 25%;
        background-color: #fff;
        content: '';
      }
 
      &--side {
        &:before {
          z-index: 1;
          background-color: #001529;
          content: '';
        }
 
        &:after {
          background-color: #fff;
        }
      }
 
      &--top {
        &:after {
          background-color: #001529;
        }
      }
    }
  }
}
</style>