File tree 1 file changed +22
-3
lines changed
1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,21 @@ module.exports = {
11
11
this . context = this . binding . isExp
12
12
? this . vm
13
13
: this . binding . compiler . vm
14
+ if ( this . el . tagName === 'IFRAME' && this . arg !== 'load' ) {
15
+ var self = this
16
+ this . iframeBind = function ( ) {
17
+ self . el . contentWindow . addEventListener ( self . arg , self . handler )
18
+ }
19
+ this . el . addEventListener ( 'load' , this . iframeBind )
20
+ }
14
21
} ,
15
22
16
23
update : function ( handler ) {
17
24
if ( typeof handler !== 'function' ) {
18
25
utils . warn ( 'Directive "v-on:' + this . expression + '" expects a method.' )
19
26
return
20
27
}
21
- this . unbind ( )
28
+ this . reset ( )
22
29
var vm = this . vm ,
23
30
context = this . context
24
31
this . handler = function ( e ) {
@@ -28,10 +35,22 @@ module.exports = {
28
35
context . $event = null
29
36
return res
30
37
}
31
- this . el . addEventListener ( this . arg , this . handler )
38
+ if ( this . iframeBind ) {
39
+ this . iframeBind ( )
40
+ } else {
41
+ this . el . addEventListener ( this . arg , this . handler )
42
+ }
43
+ } ,
44
+
45
+ reset : function ( ) {
46
+ var el = this . iframeBind
47
+ ? this . el . contentWindow
48
+ : this . el
49
+ el . removeEventListener ( this . arg , this . handler )
32
50
} ,
33
51
34
52
unbind : function ( ) {
35
- this . el . removeEventListener ( this . arg , this . handler )
53
+ this . reset ( )
54
+ this . el . removeEventListener ( 'load' , this . iframeBind )
36
55
}
37
56
}
You can’t perform that action at this time.
0 commit comments