2.4.2
https://jsfiddle.net/pi0/qnvcgujb
This is working with 2.3 but not 2.4 anymore: (see provided fiddles)
<input v-model="value" is="textarea"/>
This was the behavior of 2.3.x:
https://jsfiddle.net/pi0/yL4rwesh
When using :is="textarea" to dynamically change input type to a text area neither :value or v-model are not working anymore. (There is also a common case for both which <component :is="..." is not working)
Using dynamic components is a common usage for component libraries like BootrapVue which user can dynamically change elements behavior. here is the current implementation we are falling back to v-if/v-else as a fix, But is it an intentional breaking change?
Didn't @akryum wrote a similar issue (cannot rely find it on the phone)?
Nvmd, it was something different
鈿狅笍 component + is + textarea/input + v-model wasn't working before either because v-model is different for components.
the input + is is now behaving as a component + is (instead of treating it as an input) which is why I marked this as a regression
I still haven't checked if we introduced that to fix something else 馃槄
Will #6344 fix this issue?
@mosinve, no, it doesn't.
It seems this commit breaked it. https://github.com/vuejs/vue/commit/a1d1145c9123f7175f3ac20b503cfa507ad455f4#diff-2cd940df9e3891fae0a25ee85235edcdR486
Maybe we could check whether el.component is a real custome component before apply the genComponentModel method ? @posva
This could be a nice first contribution, I'll try to fix it over the weekend in case someone wants to have a try.
@defcc Agree on all the points!
@defcc The problem with that idea is el.component can be an expression with dynamic :is bindings, so we don't really know at compile time whether it is a component or not.
The original intention of is is really only meant for dynamic component switching, and in some cases allowing "upgrading" a normal element to a component (primarily for when using in-dom template + where HTML has element placement restrictions, e.g. trying to use a component inside <table>). So somehow I feel the current behavior sticks to that intention better...
Unfortunately, the fix by @cwang22 in #6453 will break cases where users are casting <input> into a custom component with is.
For specific cases like component libs, it's probably better to manually handle events instead of using v-model for finer-grained control.
@pi0 I looked at the latest bootstrap-vue code and it seems form-input and form-textarea are split into separate components, which I think is a better direction.
Thanks @yyx990803 for good explanation about :is directive :)
Most helpful comment
Maybe we could check whether
el.componentis a real custome component before apply the genComponentModel method ? @posvaThis could be a nice first contribution, I'll try to fix it over the weekend in case someone wants to have a try.