element-plus [Bug Report] [Component] [input] Form-Item's disabled prop can't override form's disabled prop

iovurdzv  于 2023-03-19  发布在  其他
关注(0)|答案(6)|浏览(177)

Bug Type: Component

Environment

  • Vue Version: 3.2.33
  • Element Plus Version: 2.1.11
  • Browser / OS: Chrome/100.0.4896.127/ MacOS 10.15.7
  • Build Tool: Vite

Reproduction

  • el-input

Element Plus Playground

Steps to reproduce

  1. set prop disabled of component el-form as true
  2. set prop disabled of component el-input as false

What is Expected?

component el-input is not disabled

What is actually happening?

component el-input is disabled

Additional comments

(empty)

mrwjdhj3

mrwjdhj31#

I think the current performance is right.

y1aodyip

y1aodyip2#

I think the current performance is right.

Wouldn't that apply to more scenarios if form-item could override form's disabled prop

wbrvyc0a

wbrvyc0a3#

The default disabled prop values of el-input , el-button and el-radio components are false . If they can override the disabled prop of the form, it will be meaningless to set disabled = true for the form.

twh00eeo

twh00eeo4#

If you could explict set form-item's disabled prop value as undefined , and change current useDisabled hook logic from () => disabled.value || unref(fallback) || form?.disabled || false to () => disabled.value ?? unref(fallback) ??form?.disabled ?? false , the following two scenarios will all work:

  1. when form-itme's disabled prop is unset, set form's prop disabled = true will disabled the whole form.
  2. when form-item's disabled prop is set, it can override form's disabled prop.

Sometimes there are always some kids who don't fit in, when a form-item's disabled logic not same as others, the independ disabled prop could take care of them.

相关问题