Skip to content
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

[bug report] error in reject parameter of promise mode in resetfields method of El form #21348

Closed
M76chao opened this issue Sep 28, 2021 · 1 comment · Fixed by #21374
Closed

Comments

@M76chao
Copy link

M76chao commented Sep 28, 2021

Element UI version

2.15.6

OS/Browsers version

Microsoft Edge 版本 94.0.992.31 (官方内部版本) (64 位)

Vue version

2.6.14

Reproduction Link

https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue

Steps to reproduce

this.$refs.ruleForm.validate().catch(err => {
console.log(err) // 此处没有没有捕获到错误信息
}) // ruleForm: el-form

What is Expected?

期待 Promise.catch 参数中能正确获取到 err信息

What is actually happening?

在这个文件中: https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue 的,119 行到221行,
应改为:
callback = function(valid, err) {
valid ? resolve(valid) : reject(err);
};

@element-bot element-bot changed the title [Bug Report] el-form 的 resetFields 方法中的 Promise 模式的 reject 参数错误 [bug report] error in reject parameter of promise mode in resetfields method of El form Sep 28, 2021
@element-bot
Copy link
Member

Translation of this issue:

Element UI version

2.15.6

OS/Browsers version

Microsoft edge version 94.0.992.31 (official build) (64 bit)

Vue version

2.6.14

Reproduction Link

https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue

Steps to reproduce

this.$refs.ruleForm.validate().catch(err => {

Console.log (ERR) / / no error message is captured here
}) // ruleForm: el-form

What is Expected?

It is expected that the err information can be correctly obtained in the promise.catch parameter

What is actually happening?

In this file: https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue Yes, lines 119 to 221,

Should read:
callback = function(valid, err) {

valid ? resolve(valid) : reject(err);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants