heyujie
2021-09-24 84ad5590bafc58e17ebcf7ebdce2cd70c0c22ea9
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
<template>
  <div class="switch-bar">
    <div class="name">{{ barName }}</div>
    <el-switch v-model="value" active-color="#4e94ff" @change="switchChange">
    </el-switch>
  </div>
</template>
 
<script>
export default {
  props: ["barName", "value"],
  methods: {
    switchChange(val) {
      this.$emit("switchChange", val);
    },
  },
};
</script>
<style lang="scss">
.switch-bar {
  display: flex;
  align-items: center;
  height: 50px;
  padding: 0 25px;
  justify-content: space-between;
  border-radius: 12px;
  margin-bottom: 10px;
  .el-switch {
    display: inline-flex;
    align-items: center;
    position: relative;
    font-size: 14px;
    line-height: 14px;
    height: 14px;
    vertical-align: middle;
    .el-switch__core {
      width: 30px !important;
      height: 14px;
      border: 1px solid #E0E0E0;
      border-radius: 20px;
      background: #E0E0E0;
    }
    .el-switch__core:after {
      top: 0px;
      left: -1px;
      width: 12px;
      height: 12px;
      background-color: #fff;
    }
    .el-switch.is-checked .el-switch__core::after {
      margin-left: -10px;
    }
  }
  .name {
    font-size: 12px;
    color: #4f4f4f;
    font-weight: bold;
  }
}
</style>