Skip to content

Commit 46ad8a1

Browse files
committed
fix v-on inline $event with filters (fix #1786)
1 parent a71aa59 commit 46ad8a1

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/directive.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,10 @@ Directive.prototype._checkStatement = function () {
217217
) {
218218
var fn = expParser.parse(expression).get
219219
var scope = this._scope || this.vm
220-
var handler = function () {
220+
var handler = function (e) {
221+
scope.$event = e
221222
fn.call(scope, scope)
223+
scope.$event = null
222224
}
223225
if (this.filters) {
224226
handler = scope._applyFilters(handler, null, this.filters)

src/directives/public/on.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,8 @@ module.exports = {
100100
}
101101

102102
this.reset()
103-
var scope = this._scope || this.vm
104-
this.handler = function (e) {
105-
scope.$event = e
106-
var res = handler(e)
107-
scope.$event = null
108-
return res
109-
}
103+
this.handler = handler
104+
110105
if (this.iframeBind) {
111106
this.iframeBind()
112107
} else {

0 commit comments

Comments
 (0)