@@ -14,9 +14,13 @@ import {
14
14
} from 'vue'
15
15
16
16
import { createWrapper , VueWrapper } from './vue-wrapper'
17
- import { attachEventListener } from './emitMixin'
17
+ import { attachEmitListener } from './emitMixin'
18
18
import { createDataMixin } from './dataMixin'
19
- import { MOUNT_ELEMENT_ID } from './constants'
19
+ import {
20
+ MOUNT_COMPONENT_REF ,
21
+ MOUNT_ELEMENT_ID ,
22
+ MOUNT_PARENT_NAME
23
+ } from './constants'
20
24
import { stubComponents } from './stubs'
21
25
22
26
type Slot = VNode | string | { render : Function }
@@ -82,11 +86,11 @@ export function mount<T extends ComponentPublicInstance>(
82
86
83
87
// we define props as reactive so that way when we update them with `setProps`
84
88
// Vue's reactivity system will cause a rerender.
85
- const props = reactive ( { ...options ?. props , ref : 'VTU_COMPONENT' } )
89
+ const props = reactive ( { ...options ?. props , ref : MOUNT_COMPONENT_REF } )
86
90
87
91
// create the wrapper component
88
92
const Parent = defineComponent ( {
89
- name : 'VTU_COMPONENT' ,
93
+ name : MOUNT_PARENT_NAME ,
90
94
render ( ) {
91
95
return h ( component , props , slots )
92
96
}
@@ -145,7 +149,7 @@ export function mount<T extends ComponentPublicInstance>(
145
149
}
146
150
147
151
// add tracking for emitted events
148
- attachEventListener ( vm )
152
+ vm . mixin ( attachEmitListener ( ) )
149
153
150
154
// stubs
151
155
if ( options ?. global ?. stubs ) {
@@ -156,6 +160,6 @@ export function mount<T extends ComponentPublicInstance>(
156
160
157
161
// mount the app!
158
162
const app = vm . mount ( el )
159
- const App = app . $refs [ 'VTU_COMPONENT' ] as ComponentPublicInstance
163
+ const App = app . $refs [ MOUNT_COMPONENT_REF ] as T
160
164
return createWrapper < T > ( App , setProps )
161
165
}
0 commit comments