File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 2
2
h ,
3
3
createApp ,
4
4
defineComponent ,
5
+ reactive ,
5
6
shallowReactive ,
7
+ isRef ,
6
8
FunctionalComponent ,
7
9
ComponentPublicInstance ,
8
10
ComponentOptionsWithObjectProps ,
@@ -379,12 +381,22 @@ export function mount(
379
381
const MOUNT_COMPONENT_REF = 'VTU_COMPONENT'
380
382
// we define props as reactive so that way when we update them with `setProps`
381
383
// Vue's reactivity system will cause a rerender.
382
- const props = shallowReactive ( {
384
+ const refs = shallowReactive < Record < string , unknown > > ( { } )
385
+ const props = reactive < Record < string , unknown > > ( { } )
386
+
387
+ Object . entries ( {
383
388
...options ?. attrs ,
384
389
...options ?. propsData ,
385
390
...options ?. props ,
386
391
ref : MOUNT_COMPONENT_REF
392
+ } ) . forEach ( ( [ k , v ] ) => {
393
+ if ( isRef ( v ) ) {
394
+ refs [ k ] = v
395
+ } else {
396
+ props [ k ] = v
397
+ }
387
398
} )
399
+
388
400
const global = mergeGlobalProperties ( options ?. global )
389
401
if ( isObjectComponent ( component ) ) {
390
402
component . components = { ...component . components , ...global . components }
@@ -394,7 +406,7 @@ export function mount(
394
406
const Parent = defineComponent ( {
395
407
name : 'VTU_ROOT' ,
396
408
render ( ) {
397
- return h ( component , props , slots )
409
+ return h ( component as ComponentOptions , { ... props , ... refs } , slots )
398
410
}
399
411
} )
400
412
You can’t perform that action at this time.
0 commit comments