File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,21 @@ module.exports = {
1111 this . context = this . binding . isExp
1212 ? this . vm
1313 : 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+ }
1421 } ,
1522
1623 update : function ( handler ) {
1724 if ( typeof handler !== 'function' ) {
1825 utils . warn ( 'Directive "v-on:' + this . expression + '" expects a method.' )
1926 return
2027 }
21- this . unbind ( )
28+ this . reset ( )
2229 var vm = this . vm ,
2330 context = this . context
2431 this . handler = function ( e ) {
@@ -28,10 +35,22 @@ module.exports = {
2835 context . $event = null
2936 return res
3037 }
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 )
3250 } ,
3351
3452 unbind : function ( ) {
35- this . el . removeEventListener ( this . arg , this . handler )
53+ this . reset ( )
54+ this . el . removeEventListener ( 'load' , this . iframeBind )
3655 }
3756}
You can’t perform that action at this time.
0 commit comments