how to bind ref value in tsx? #7235
Replies: 8 comments 2 replies
-
|
Beta Was this translation helpful? Give feedback.
-
it's not a model value, only props but need update when running, it's ok when use it in template |
Beta Was this translation helpful? Give feedback.
-
demo |
Beta Was this translation helpful? Give feedback.
-
sfc playground can't use tsx, so it's hard to provide demo, I am only know how to write sfc
|
Beta Was this translation helpful? Give feedback.
-
demo |
Beta Was this translation helpful? Give feedback.
-
thanks, pass ref to props should be ok, but it show error in volar, hope the perfect solution, now I have to convert type also |
Beta Was this translation helpful? Give feedback.
-
but it still show warning in console: |
Beta Was this translation helpful? Give feedback.
-
also it's failed when I use watch in component to detect props change:
can't fired when I change x.value in parent |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
it's ok when use in template
but when use in tsx:
const comp=<Comp value={x} />
it run ok but show error with: ts2322
"Type 'Ref' is not assignable to type 'number'."
if I use value={x.value}, it lost reactive
Beta Was this translation helpful? Give feedback.
All reactions