Skip to content
huangchengwen edited this page Apr 16, 2017 · 1 revision

Switch API

Support WEB

Switch 切换组件

Properties Descrition Type Default
name 文本域 Sting null
disabled 是否可切换 bool false
onChange 切换回调 function null

使用实例

import { Component } from 'react'
import Switch from '../../../packages/switch';

export default class DemoSwitch extends Component {

	change1(e) {
		console.log(e.target.checked)
	}

	render() {
		return(
			<div className="fm-list">
				<div className="fm-list-header">switch 滑动开关</div>
				<div className="fm-list-body">
					<div className="fm-list-item">
						<div className="fm-list-content">选中状态</div>
						<Switch name="switch1" checked={true} onChange={this.change1.bind(this)}/>
					</div>
					<div className="fm-list-item">
						<div className="fm-list-content">未选中状态</div>
						<Switch name="switch2"/>
					</div>

					<div className="fm-list-item">
						<div className="fm-list-content">禁用状态</div>
						<Switch name="switch3" disabled={true}/>
					</div>
				</div>
			</div>
		);
	}
}

展示

https://eric124120.github.io/fmui-react/#/switch

Clone this wiki locally