@@ -32,7 +32,7 @@ import {
32
32
} from './utils'
33
33
import { processSlot } from './utils/compileSlots'
34
34
import { createWrapper , VueWrapper } from './vueWrapper'
35
- import { attachEmitListener } from './emitMixin '
35
+ import { attachEmitListener } from './emit '
36
36
import { createDataMixin } from './dataMixin'
37
37
import { MOUNT_COMPONENT_REF , MOUNT_PARENT_NAME } from './constants'
38
38
import { createStub , stubComponents } from './stubs'
@@ -233,16 +233,8 @@ export function mount(
233
233
let component
234
234
235
235
if ( isFunctionalComponent ( originalComponent ) ) {
236
- // we need to wrap it like this so we can capture emitted events.
237
- // we capture events using a mixin that mutates `emit` in `beforeCreate`,
238
- // but functional components do not support mixins, so we need to wrap it
239
- // and make it a non-functional component for testing purposes.
240
236
component = defineComponent ( {
241
- setup : ( _ , { attrs, slots, emit } ) => ( ) => {
242
- return h ( ( props : any , ctx : any ) =>
243
- originalComponent ( props , { ...ctx , ...attrs , emit, slots } )
244
- )
245
- }
237
+ setup : ( _ , { attrs, slots } ) => ( ) => h ( originalComponent , attrs , slots )
246
238
} )
247
239
} else if ( isObjectComponent ( originalComponent ) ) {
248
240
component = { ...originalComponent }
@@ -346,6 +338,9 @@ export function mount(
346
338
return vm . $nextTick ( )
347
339
}
348
340
341
+ // add tracking for emitted events
342
+ attachEmitListener ( )
343
+
349
344
// create the app
350
345
const app = createApp ( Parent )
351
346
@@ -408,9 +403,6 @@ export function mount(
408
403
}
409
404
}
410
405
411
- // add tracking for emitted events
412
- app . mixin ( attachEmitListener ( ) )
413
-
414
406
// stubs
415
407
// even if we are using `mount`, we will still
416
408
// stub out Transition and Transition Group by default.
0 commit comments