[feature request] how the custom component passes the elementui form verification

hivapdat  于 2022-11-13  发布在  ElementUI
关注(0)|答案(2)|浏览(164)

Existing Component

Component Name

form

Description

碰到一个问题,如果用原生html封装组件会无法触发element ui的表单校验,需要点击提交按钮才能校验。
rules里的trigger: 'blur’ 或者 trigger: 'change’ 已经不起效了。

虽然 知道 是
从源码可以看出 onFieldBluronFieldChange 这两个回调函数里触发,而这两个函数的触发方式是通过在addValidateEvents中监听el.form.blur和el.form.change

尝试过 无效
1, this.dispatch('elFormItem', 'el.form.change', [a])
2, 百度的分章

ecfdbz9o

ecfdbz9o1#

Translation of this issue:

Existing Component

yes

Component Name

form

Description

If you encounter a problem, if you encapsulate the component with native HTML, you will not be able to trigger the form verification of element UI. You need to click the submit button to verify.

The trigger: 'blur' or trigger: 'change' in rules doesn't work anymore.
Although I know it is

From the source code, it can be seen that 'onfieldblur' and 'onfieldchange' are triggered in the callback functions, and these two functions are triggered by listening to el.form.blur and el.form.change in addvalidateevents
Invalid attempt

1, this.dispatch('elFormItem', 'el.form.change', [a])
2. Baidu's sub chapter

yeotifhr

yeotifhr2#

Translation of this issue:

Existing Component

yes

Component Name

form

Description

If you encounter a problem, if you encapsulate the component with native HTML, you will not be able to trigger the form verification of element UI. You need to click the submit button to verify.

The trigger: 'blur' or trigger: 'change' in rules doesn't work anymore. Although I know it is

From the source code, it can be seen that 'onfieldblur' and 'onfieldchange' are triggered in the callback functions, and these two functions are triggered by listening to el.form.blur and el.form.change in addvalidateevents Invalid attempt

1, this.dispatch('elFormItem', 'el.form.change', [a]) 2. Baidu's sub chapter

Existing Component

Component Name

form

Description

碰到一个问题,如果用原生html封装组件会无法触发element ui的表单校验,需要点击提交按钮才能校验。 rules里的trigger: 'blur’ 或者 trigger: 'change’ 已经不起效了。

虽然 知道 是 从源码可以看出 onFieldBluronFieldChange 这两个回调函数里触发,而这两个函数的触发方式是通过在addValidateEvents中监听el.form.blur和el.form.change

尝试过 无效 1, this.dispatch('elFormItem', 'el.form.change', [a]) 2, 百度的分章

想问下,你解决了吗?我也遇到了这个问题,element-ui 版本是2.15.3

相关问题