Ant Design of Vue —— setFieldsValue方法 动态操作Switch组件

在开发中经常使用Form组件管理表单,这次想通过form提供的setFieldsValue()方法动态改变Switch组件状态,却没有生效。

查阅官方文档之后,发现有如下说明: 

加入valuePropName属性之后,就可以使用动态操作Switch组件了。

例如:
 1 <a-switch
 2   checkedChildren="开"
 3     unCheckedChildren="关"
 4     v-decorator="[
 5        'templateExempt',
 6        {
 7           valuePropName: 'checked',
 8           rules: [ { required: true, message: '' }]
 9        }
10     ]"
11 />
 
 
 

猜你喜欢

转载自www.cnblogs.com/duoer/p/12114548.html
今日推荐