Skip to content

Commit 9f37c9a

Browse files
committed
bindEvents fix
1 parent a97b74c commit 9f37c9a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ class EventManagment extends JSEventManagment {
88
$once = super.once
99
}
1010

11-
function bindEvents (obj: any, from: string, to: string): void {
11+
function bindEvents (context, obj: any, from: string, to: string): void {
1212
let evts = obj[from];
1313
if (evts) {
1414
obj[to] = {}
1515
for (var k in evts) {
16-
obj[to][k] = ~evts[k].name.indexOf('bound ') ? evts[k] : evts[k].bind(this)
16+
obj[to][k] = ~evts[k].name.indexOf('bound ') ? evts[k] : evts[k].bind(context)
1717
}
1818
}
1919
}
@@ -52,8 +52,8 @@ const eventsPlugins: PluginFunction<any> = (Vue) => {
5252
beforeCreate() {
5353
let $this: any = this;
5454
let options = $this.$options;
55-
bindEvents(options, 'on', '$setEventsOn')
56-
bindEvents(options, 'once', '$setEventsOnce')
55+
bindEvents(this, options, 'on', '$setEventsOn')
56+
bindEvents(this, options, 'once', '$setEventsOnce')
5757
},
5858
created() {
5959
let $this: any = this;

0 commit comments

Comments
 (0)