Switch 开关列表
Cell延伸的自定义组件
import React from 'react';
import ReactDOM from 'react-dom';
import Cells from 'n7-react-weui/lib/cells/cells';
import SwitchCell from 'n7-react-weui/lib/cells/switch-cell';
//自定义Switch Cell创建
const CustomCell = () => {
return (
<SwitchCell name="switch1" id="sw1" label="标题文字" />
);
}
//加载自定义Cell
const WeUI = () => {
return (
<Cells title="带说明的列表项">
<CustomCell/>
</Cells>
);
}
ReactDOM.render(<WeUI />, document.getElementById('main'));
SwitchCell Property 列表属性
| Name | Type | Default | Description |
|---|---|---|---|
| className | String | 用于添加自定义class属性 | |
| label | String | null | 标题文字 |
| disabled | bool | false | 禁用模式 |
| onChange | func | '' | 当开关切换时候的函数 |
| onClick | func | '' | 当开关被点击时候的函数 |