Ant-design-mobile: 关于switch组件的value值绑定

Created on 16 Mar 2018  ·  2Comments  ·  Source: ant-design/ant-design-mobile

What problem does this feature solve?

我在官方文档中看到的switch组件只能通过“rc-form”,去控制switch的状态,无法通过通常的 value<==>onChange() 进行数据绑定。我的业务场景是切换状态时会有一个弹窗提示再进行切换,以官网的例子似乎无法做到这一点。非常感谢您的解答

What does the proposed API look like?

期望的switch组件使用方式:

<Switch
    value={checked}
    onChange={checked => {
        this.setState({checked})
    }}
 />

All 2 comments

It will be better to write your issue/comment in English, so more people can understand you.
And this means that more people can help you or benefit from your issue/comment.
See: https://github.com/ant-design/ant-design/issues/4897

Was this page helpful?
0 / 5 - 0 ratings