-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Open
Description
Vue version
3.5.25
Link to minimal reproduction
Steps to reproduce
- Get an object with a nested (non top-level) ref.
- Try to bind that ref to a
v-model. - In the playground example, try using the "Nested" slider, then "Nested+proxy"
What is expected?
All three sliders should work.
One could expect that v-model, being a shorthand for prop .value and signal/event handler .value = newValue, should be accepting writable refs, not matter where they come from.
What is actually happening?
Instead,
- only top-level refs are working (first and third sliders),
- but trying to bind a nested ref (second slider) breaks the whole object,
- and complains with TypeScript error
Type 'Ref<number, number>' is not assignable to type 'number'.(on my local setup, but not on the Playground for some reason).
As you can see in the Playground code, I had to resort to an otherwise pretty pointless computed({get, set}) proxy just to get the slider accept my Ref as a model.
System Info
Firefox: 145.0.2
vue: 3.5.25Any additional comments?
I don't get it, how can the type of v-model= be just a number, and not some sort of ModelRef or whatever writable Ref? What kind of black magic syntax desugaring prevents this from working as expected?
Metadata
Metadata
Assignees
Labels
No labels