Browse Source

refactor: ensure setup context.emit always point to intenral emit

Evan You 6 years ago
parent
commit
e308ad99e9
1 changed files with 3 additions and 1 deletions
  1. 3 1
      packages/runtime-core/src/component.ts

+ 3 - 1
packages/runtime-core/src/component.ts

@@ -493,7 +493,9 @@ function createSetupContext(instance: ComponentInternalInstance): SetupContext {
     // need to expose them through a proxy
     attrs: new Proxy(instance, SetupProxyHandlers.attrs),
     slots: new Proxy(instance, SetupProxyHandlers.slots),
-    emit: instance.emit
+    get emit() {
+      return instance.emit
+    }
   }
   return __DEV__ ? Object.freeze(context) : context
 }