element-plus [Component] [select] ElSelect showing validation error too early

tvz2xvvm  于 5个月前  发布在  其他
关注(0)|答案(2)|浏览(113)

Bug Type: Component

Environment

  • Vue Version: 3.2.45
  • Element Plus Version: 2.2.25
  • Browser / OS: Chrome (latest)
  • Build Tool: Vue CLI

Reproduction

  • el-select

Element Plus Playground

Steps to reproduce

When the value of an multi-select field is not set to an empty array initially but is undefined , the error is already displayed on page-load, because the "change" is triggered.

What is Expected?

It should not trigger the validation for the initial page load.

What is actually happening?

An error is already shown.

Additional comments

Please have a look at the reproduction link for a demo.

a2mppw5e

a2mppw5e1#

The initial value in the multiple mode must be an array

lqfhib0f

lqfhib0f2#

I know. But I think it is inconsistent with other fields (like el-input) where the initial value could also be empty (undefined and not an empty string).
Currently el-select is able to have an initial value of "undefined". It automatically transforms this to an array. But this seems to be implemented wrongly, as the validation trigger should be executed AFTER this transformation.

相关问题