<switch>
0.4 cn
Summary
The weex builtin component switch is used to create and manage a IOS styled On/Off buttons used, for example, in the Settings app for options such as 'muted' and 'toggle color'.
Child Components
This component supports no child components.
Attributes
checked: <boolean>true|false. The initial value of whether the status of this button is On or Off.
Other attributes please check out the common attributes.
Styles
Notes: There are several style properties that you mustn't use on this component, mostly have impact on the layout. Here are all the invalid properties:
widthheightmin-widthmin-heightmarginandmargin-xxspaddingandpadding-xxsborderandborder-xxs
Notes: Specially the width and height related properties is not configurable and the size of this component is fixed to 100x60 (for the design width 750px).
Events
click: check out common events
common events: check out the common events
- support
clickevent. Check out common events - support
appear/disappearevent. Check out common events
Parameters of events' object
- for
changeevent:- value: the value of the component who dispatched this event, which is the boolean value
trueorfalse. - timestamp: the time stamp of the event.
- value: the value of the component who dispatched this event, which is the boolean value
Example
<div>
<text>muted:</text>
<switch checked="true"></switch>
</div>