-
zhangwei
2025-03-05 16213c0f85aa3ac8317797bf4a05fd12940e16d3
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
import { AllowedComponentProps, VNodeProps } from './_common'
 
declare interface SwitchProps {
  /**
   * 是否处于加载中
   * @default false
   */
  loading?: boolean
  /**
   * 是否禁用
   * @default false
   */
  disabled?: boolean
  /**
   * 开关尺寸,单位rpx
   */
  size?: string | number
  /**
   * 打开时的背景色
   * @default "#2979ff"
   */
  activeColor?: string
  /**
   * 关闭时的背景色
   * @default "#ffffff"
   */
  inactiveColor?: string
  /**
   * 通过v-model双向绑定的值
   * @default false
   */
  value?: string | number | boolean
  /**
   * switch打开时的值
   * @default true
   */
  activeValue?: string | number | boolean
  /**
   * switch关闭时的值
   * @default false
   */
  inactiveValue?: string | number | boolean
  /**
   * 是否开启异步变更,开启后需要手动控制输入值
   * @default false
   */
  asyncChange?: boolean
  /**
   * 圆点与外边框的距离
   * @default 0
   */
  space?: string | number
  /**
   * 在`switch`打开或关闭时触发
   * @param value 打开时为`activeValue`值,关闭时为`inactiveValue`值
   */
  onChange?: (value: any) => any
  /**
   * 在`switch`打开或关闭时触发(没开启异步)
   * @param value 打开时为`activeValue`值,关闭时为`inactiveValue`值
   */
  onInput?: (value: any) => any
}
 
declare interface _Switch {
  new (): {
    $props: AllowedComponentProps &
      VNodeProps &
      SwitchProps
  }
}
 
export declare const Switch: _Switch