[antdv: FormModel] model is required for resetFields to work

使用Vue+ant的UI框架进行表单绑定时报错,提示'model is required for resetFields to work'。经测试发现是未在表头使用 :model=\xxx\ 进行数据绑定,解决方法是在表头使用 :model=\form\ 绑定表单数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天在用Vue+ant的UI框架进行表单绑定的时候出现报错 Warning: [antdv: FormModel] model is required for resetFields to work.通过不断测试才发现是因为没有在表头使用 :model="xxx"进行数据绑定

  <a-form-model :model="form" :rules="rules" ref="ruleForm" :layout="'horizontal'" :labelCol="{ span: 5 }">
    <a-form-model-item prop="deptName" label="学校名称" :wrapper-col="{ span: 18 }">
    </a-form-model-item>
  </a-form-model>

解决方法:
在表头使用:model="form"绑定表单数据即可解决

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值