zj
2024-06-03 96140d8eb2531144828dffe2ad8c19d0d9431009
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
<template>
  <div class="mt-20">
    <div class="pl-32 pr-32 mb-40 text-grey">
      <slot></slot>
    </div>
    <van-cell-group class="w-full pl-32 pr-32 border-b-grey border-light-grey box-border">
      <van-cell
          class="items-center mb-32"
          v-for="(option, index) in options"
          :key="index"
          :title="option.title"
      >
        <template #default>
          <van-switch v-if="!option.disabled" v-model="option.checked"   @change="$emit('changeSwitch',option)"/>
          <van-switch v-else disabled v-model="option.checked" />
        </template>
      </van-cell>
    </van-cell-group>
  </div>
</template>
 
<script>
import {Cell, CellGroup, Switch,} from 'vant';
 
export default {
  name: "SettingsItem",
  props: ['options'],
  components: {
    [Cell.name]: Cell,
    [CellGroup.name]: CellGroup,
    [Switch.name]: Switch,
  }
}
</script>
 
<style lang="scss" scoped>
 
 
::v-deep {
  .van-cell__title {
    font-size: 30px;
    color: #000;
  }
 
  .van-cell__value {
    display: flex;
    align-items: center;
    justify-content: end;
  }
 
  .van-switch {
    transform: scale(.8);
    background: #E9EBEE;
  }
 
  .van-switch--on {
    background-color: #1989fa;
  }
}
 
</style>