|
1 |
| -var _ = require('../../util') |
| 1 | +import { on, off, warn } from '../../util' |
2 | 2 |
|
3 | 3 | // keyCode aliases
|
4 |
| -var keyCodes = { |
| 4 | +const keyCodes = { |
5 | 5 | esc: 27,
|
6 | 6 | tab: 9,
|
7 | 7 | enter: 13,
|
@@ -48,34 +48,34 @@ function preventFilter (handler) {
|
48 | 48 | }
|
49 | 49 | }
|
50 | 50 |
|
51 |
| -module.exports = { |
| 51 | +export default { |
52 | 52 |
|
53 | 53 | acceptStatement: true,
|
54 | 54 | priority: 700,
|
55 | 55 |
|
56 |
| - bind: function () { |
| 56 | + bind () { |
57 | 57 | // deal with iframes
|
58 | 58 | if (
|
59 | 59 | this.el.tagName === 'IFRAME' &&
|
60 | 60 | this.arg !== 'load'
|
61 | 61 | ) {
|
62 | 62 | var self = this
|
63 | 63 | this.iframeBind = function () {
|
64 |
| - _.on(self.el.contentWindow, self.arg, self.handler) |
| 64 | + on(self.el.contentWindow, self.arg, self.handler) |
65 | 65 | }
|
66 | 66 | this.on('load', this.iframeBind)
|
67 | 67 | }
|
68 | 68 | },
|
69 | 69 |
|
70 |
| - update: function (handler) { |
| 70 | + update (handler) { |
71 | 71 | // stub a noop for v-on with no value,
|
72 | 72 | // e.g. @mousedown.prevent
|
73 | 73 | if (!this.descriptor.raw) {
|
74 | 74 | handler = function () {}
|
75 | 75 | }
|
76 | 76 |
|
77 | 77 | if (typeof handler !== 'function') {
|
78 |
| - process.env.NODE_ENV !== 'production' && _.warn( |
| 78 | + process.env.NODE_ENV !== 'production' && warn( |
79 | 79 | 'v-on:' + this.arg + '="' +
|
80 | 80 | this.expression + '" expects a function value, ' +
|
81 | 81 | 'got ' + handler
|
@@ -105,20 +105,20 @@ module.exports = {
|
105 | 105 | if (this.iframeBind) {
|
106 | 106 | this.iframeBind()
|
107 | 107 | } else {
|
108 |
| - _.on(this.el, this.arg, this.handler) |
| 108 | + on(this.el, this.arg, this.handler) |
109 | 109 | }
|
110 | 110 | },
|
111 | 111 |
|
112 |
| - reset: function () { |
| 112 | + reset () { |
113 | 113 | var el = this.iframeBind
|
114 | 114 | ? this.el.contentWindow
|
115 | 115 | : this.el
|
116 | 116 | if (this.handler) {
|
117 |
| - _.off(el, this.arg, this.handler) |
| 117 | + off(el, this.arg, this.handler) |
118 | 118 | }
|
119 | 119 | },
|
120 | 120 |
|
121 |
| - unbind: function () { |
| 121 | + unbind () { |
122 | 122 | this.reset()
|
123 | 123 | }
|
124 | 124 | }
|
0 commit comments