-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can i reset form,i can't found method clearValidationEffect method in form ref #96
Comments
The docs have mistakes, I've fixed it. About resetting, naive-ui doesn't provide a method for reset a form. Form just collect values and do validation to the corresponding form items. If you want to restore a value. Just implemenet it. For example: {
setup () {
const formInitValue = { key: 'value' }
const formValueRef = ref({ ...formInitValue })
const resetFormValue = () => { formValueRef.value = formInitValue }
// ...
}
} |
@07akioni Writing this seems to lead to object double reference problems, |
@07akioni form.value = { ...formInitValue } 它是可以的 |
是的,我们这个表格由于实现的比较简陋,内部根本不去收集值,完全是受控的,想恢复就是记录一下初始值的事 |
应该提供这个方法吧 还是经常使用的 |
提供不了,数据是用户自己控制的,表格改不了这玩意 |
或许可以用 v-model:model 来做一个简单的清除工作,不过 emmm 确实感觉意义不大,省不了多少代码。 用户如果要自己搞这个事其实很简单,只多三行代码
|
Environment Info
Reproduction link
https://codesandbox.io/s/naive-ui-test-vi95j?file=/src/App.vue:1326-1347
Steps to reproduce
click reset botton
What is expected?
the form can be reset
What is actually happening?
The form does not have a method called clearValidationEffect ,and with an error,but i found a method called restoreValidation,it is useful for clear validation ,but not for form's value
The text was updated successfully, but these errors were encountered: