np-form Imperative Methods

After getting the form instance via ref, you can imperatively call submit, reset, and validateFields.

  • submit: trigger form submission manually. Behaves like the submit button — validates first, then runs onSubmit.
  • reset: trigger form reset manually. Behaves like the reset button — clears validation and runs onReset.
  • validateFields: validate the specified fields by name.
浏览器不支持,请手动复制 imperative.en.vue

Component Configuration

FormInst methods

MethodDescriptionType
submitSubmit the form manually() => Promise<void>
resetReset the form manually() => Promise<void>
validateFieldsValidate the given fields(fields: string | string[]) => Promise<void>