2.0.0 • Published 3 years ago

shinemo-switch v2.0.0

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
3 years ago

开关 / Switch

使用

参数类型备注
checkedBoolean是否选中
disabledBoolean是否不可切换
onChangeNumber切换时的回调
clsString外层容器class
import React from 'react'
import ReactDOM from 'react-dom'
import Switch from '@xm/Switch'

const onChange = (isChecked) => {
  console.log(isChecked)
}

ReactDOM.render((<div>
  <div>默认不选中,<Switch /></div>
  <div>默认选中,<Switch checked onChange={onChange} /></div>
  <div>默认不选中,disabled<Switch disabled /></div>
  <div>默认选中,disabled<Switch checked disabled /></div>
</div>), document.getElementById('app'))