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 SwitchandCheckboxis thatSwitchwill trigger a state change directly when you toggle it, whileCheckboxis 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 Switchis 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:defaultsmall | 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 |