mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-05 13:39:40 +08:00
f265a7bb02
* fix docs dark theme & add docs coverDark * fix theme Editor edit
1.8 KiB
1.8 KiB
category | type | title | cover | coverDark |
---|---|---|---|---|
Components | Data Entry | Switch | https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*rtArRpBNDZcAAAAAAAAAAAAADrJ8AQ/original | https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*al07RK8SGf4AAAAAAAAAAAAADrJ8AQ/original |
Switching Selector.
When To Use
- If you need to represent the switching between two states or on-off state.
- The difference between
Switch
andCheckbox
is thatSwitch
will trigger a state change directly when you toggle it, whileCheckbox
is generally used for state marking, which should work in conjunction with submit operation.
API
Property | Description | Type | Default | Version |
---|---|---|---|---|
autofocus | get focus when component mounted | boolean | false | |
checked(v-model) | determine whether the Switch is checked |
checkedValue | unCheckedValue | false | |
checkedChildren | content to be shown when the state is checked | string|slot | ||
checkedValue | value for checked state | boolean | string | number | true | 2.2.1 |
disabled | Disable switch | boolean | false | |
loading | loading state of switch | boolean | false | |
size | the size of the Switch , options: default small |
string | default | |
unCheckedChildren | content to be shown when the state is unchecked | string|slot | ||
unCheckedValue | value for unchecked state | boolean | string | number | false | 2.2.1 |
Events
Events Name | Description | Arguments | |
---|---|---|---|
change | trigger when the checked state is changing | Function(checked: boolean | string | number, event: Event) | |
click | trigger when clicked | Function(checked: boolean | string | number, event: Event) |
Methods
Name | Description |
---|---|
blur() | remove focus |
focus() | get focus |