From f4196d28a4f6ca12e6adea22bb2c7452aae5a4e9 Mon Sep 17 00:00:00 2001 From: shixin Date: Wed, 18 Nov 2020 19:35:38 +0800 Subject: [PATCH] fix: delete useless code --- src/mount.ts | 4 +--- src/vueWrapper.ts | 10 +++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/mount.ts b/src/mount.ts index 684d39f2e..4c51a5d17 100644 --- a/src/mount.ts +++ b/src/mount.ts @@ -238,8 +238,6 @@ export function mount( // normalise the incoming component let component - const functionalComponentEmits: Record = {} - if (isFunctionalComponent(originalComponent)) { // we need to wrap it like this so we can capture emitted events. // we capture events using a mixin that mutates `emit` in `beforeCreate`, @@ -422,7 +420,7 @@ export function mount( const vm = app.mount(el) const App = vm.$refs[MOUNT_COMPONENT_REF] as ComponentPublicInstance - return createWrapper(app, App, setProps, functionalComponentEmits) + return createWrapper(app, App, setProps) } export const shallowMount: typeof mount = (component: any, options?: any) => { diff --git a/src/vueWrapper.ts b/src/vueWrapper.ts index 59382e1b8..708c0432f 100644 --- a/src/vueWrapper.ts +++ b/src/vueWrapper.ts @@ -14,20 +14,17 @@ export class VueWrapper { private rootVM: ComponentPublicInstance private __app: App | null private __setProps: ((props: Record) => void) | undefined - private __functionalEmits: Record constructor( app: App | null, vm: ComponentPublicInstance, - setProps?: (props: Record) => void, - functionalEmits?: Record + setProps?: (props: Record) => void ) { this.__app = app // root is null on functional components this.rootVM = vm?.$root this.componentVM = vm as T this.__setProps = setProps - this.__functionalEmits = functionalEmits // plugins hook config.plugins.VueWrapper.extend(this) } @@ -247,8 +244,7 @@ export class VueWrapper { export function createWrapper( app: App | null, vm: ComponentPublicInstance, - setProps?: (props: Record) => void, - functionalComponentEmits?: Record + setProps?: (props: Record) => void ): VueWrapper { - return new VueWrapper(app, vm, setProps, functionalComponentEmits) + return new VueWrapper(app, vm, setProps) }