2
0
Эх сурвалжийг харах

fix v-on inline $event with filters (fix #1786)

Evan You 10 жил өмнө
parent
commit
46ad8a1cd5

+ 3 - 1
src/directive.js

@@ -217,8 +217,10 @@ Directive.prototype._checkStatement = function () {
   ) {
     var fn = expParser.parse(expression).get
     var scope = this._scope || this.vm
-    var handler = function () {
+    var handler = function (e) {
+      scope.$event = e
       fn.call(scope, scope)
+      scope.$event = null
     }
     if (this.filters) {
       handler = scope._applyFilters(handler, null, this.filters)

+ 2 - 7
src/directives/public/on.js

@@ -100,13 +100,8 @@ module.exports = {
     }
 
     this.reset()
-    var scope = this._scope || this.vm
-    this.handler = function (e) {
-      scope.$event = e
-      var res = handler(e)
-      scope.$event = null
-      return res
-    }
+    this.handler = handler
+
     if (this.iframeBind) {
       this.iframeBind()
     } else {