v0.6.1+
The weex builtin component switch is used to create and manage an IOS styled On/Off buttons, for example, the Airplane mode button in the Settings app is a switch button.
example
<template> <div> <text>muted:</text> <switch checked="true" onclick='onclick' onchange='onchange' ondisappear='ondisappear' onappear='onappear'></switch> </div> </template> <script> module.exports ={ methods:{ onclick:function(e){ console.log('onclick:' + e.timestamp); }, onchange:function(e){ console.log('onchage, value:' + e.value); }, ondisappear:function(e){ console.log('ondisappear, value:' + e.value); }, onappear:function(e){ console.log('onappear, value:' + e.value); }, } } </script>
There are no child components for the switch component.
Other attributes please check out the common attributes.
Notes: There are several style properties that you mustn't use on this component. And here are all the invalid properties:
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).
common styles: check out common styles for components