跳转到内容

Switch

开关

何时使用

  • 需要表示开关状态/两种状态之间的切换时;

  • 和 checkbox 的区别是,切换 switch 会直接触发状态改变,而 checkbox 一般用于状态标记,需要和提交操作配合。

API

ISwitchProps

参数类型说明默认值
size’small’ | ‘default’尺寸-

用法

<View title="Switch" version="2">
<Record key="person" model="trantor_doc_Person" />
<Form model="trantor_doc_Person" title="编辑态">
<Fields>
<Field name="isDeleted">
<RenderType>
<Switch />
</RenderType>
</Field>
</Fields>
</Form>
</View>

注意:当前例子为0.17.x 版本