view Ui 里的from表单重置问题 this.$refs.form.resetFields
ui 组件中,给resetField方法的定义是对整个表单进行重置,将所有字符值重置为初始值并移除校验结果
![Alt](https://i-blog.csdnimg.cn/blog_migrate/e54f727deb3f2290dcde3a6a8aa87eba.png)
但是实际的工作当中,发现
1.resetFields()只对具有校验的表单元素有关系
2.resetFields()重置并不绝对的意味着将表单设置为空,而是初识值
一、解决方法
this.$refs.form.resetFields()
this.form.name = ''
this.form.description = ''
this.form.id = ''
3、写resetFields的原因:解决点击取消或者右上角的X之后,再进入新增角色的校验信息不消失的问题
```javascript
// 将表单重置放在最上边用来解决关闭之后校验信息不再出现的问题
this.$refs.form.resetFields() // 先去掉校验的功能
this.form.name = ''
this.form.description = ''
this.form.id = ''