Skip to content

Commit a979c00

Browse files
LinusBorgliximomo
authored andcommitted
feat: expose listeners on context
1 parent 54b064a commit a979c00

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export function mixin(Vue: VueConstructor) {
216216
const ctx = {
217217
slots: {},
218218
} as SetupContext;
219-
const props: Array<string | [string, string]> = ['root', 'parent', 'refs', 'attrs'];
219+
const props: Array<string | [string, string]> = ['root', 'parent', 'refs', 'attrs', 'listeners'];
220220
const methodReturnVoid = ['emit'];
221221
props.forEach(key => {
222222
let targetKey: string;

test/setupContext.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe('setupContext', () => {
1515
expect(context.parent).toBe(vm.$parent);
1616
expect(context.slots).toBeDefined();
1717
expect(context.attrs).toBe(vm.$attrs);
18+
expect(context.listeners).toBe(vm.$listeners);
1819

1920
// CAUTION: this will be removed in 3.0
2021
expect(context.refs).toBe(vm.$refs);

0 commit comments

Comments
 (0)