Use defineModel
instead of custom useVModel
composable
#994
Labels
defineModel
instead of custom useVModel
composable
#994
Uh oh!
There was an error while loading. Please reload this page.
Overview of the problem
Oruga version: [0.8.]
Vuejs version: [3.4.]
With several releases from 0.8.3 untill 0.8.10, we changed our custom
useVModel
composable to the Vue nativedefineModel
implementation for bi-directional properties.However, there are some issues with
defineModel
that prevent us from implementing further type support and enhancements.Our component documentation process relies entirely on the
vue-docgen-api
. On #985 we have already enhanced it with avue-component-meta
integration, which allows us to use more modern Vue features.But
vue-component-meta
cannot extractdefinModel
js-doc comments, so we also have to define the property indefineProps
with the js-doc comment ahead as well as indefineEmits
, but also havedefineModel
for the implementation purpose.Actual behavior
Now the problem we have is that Vue has some problems merging the
defineProps
with thedefineModel
type definition of a property that is typed by a component generic type.This seems to be an known vue core issue and might be fixed with Vue 3.5 (vuejs/core#10801), but is not quite ready yet (vuejs/core#9652, vuejs/core#9277).
Therefore, I reverted some two-way-binded props with a custom
useVModel
composable in #998, which implements the bi-directional behaviour at runtime and is fully dependent on thedefineProps
anddefineEmits
definitions, instead of the compile-timedefinModel
macro.Expected behavior
The type of a property defined in both
defineModel
anddefineProps
will merge properly when using generic types.Any bi-directional property should work with generic component types.
The text was updated successfully, but these errors were encountered: