0.4 cn
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'.
This component supports no child components.
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.
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:
width
height
min-width
min-height
margin
andmargin-xx
spadding
andpadding-xx
sborder
andborder-xx
s
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).
click
: check out common events
common events: check out the common events
- support
click
event. Check out common events - support
appear
/disappear
event. Check out common events
- for
change
event:- value: the value of the component who dispatched this event, which is the boolean value
true
orfalse
. - timestamp: the time stamp of the event.
- value: the value of the component who dispatched this event, which is the boolean value
<div>
<text>muted:</text>
<switch checked="true"></switch>
</div>