Skip to content

Commit 4e37f78

Browse files
committed
v-on
1 parent a545034 commit 4e37f78

File tree

1 file changed

+11
-11
lines changed
  • src/directives/public

1 file changed

+11
-11
lines changed

src/directives/public/on.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var _ = require('../../util')
1+
import { on, off, warn } from '../../util'
22

33
// keyCode aliases
4-
var keyCodes = {
4+
const keyCodes = {
55
esc: 27,
66
tab: 9,
77
enter: 13,
@@ -48,34 +48,34 @@ function preventFilter (handler) {
4848
}
4949
}
5050

51-
module.exports = {
51+
export default {
5252

5353
acceptStatement: true,
5454
priority: 700,
5555

56-
bind: function () {
56+
bind () {
5757
// deal with iframes
5858
if (
5959
this.el.tagName === 'IFRAME' &&
6060
this.arg !== 'load'
6161
) {
6262
var self = this
6363
this.iframeBind = function () {
64-
_.on(self.el.contentWindow, self.arg, self.handler)
64+
on(self.el.contentWindow, self.arg, self.handler)
6565
}
6666
this.on('load', this.iframeBind)
6767
}
6868
},
6969

70-
update: function (handler) {
70+
update (handler) {
7171
// stub a noop for v-on with no value,
7272
// e.g. @mousedown.prevent
7373
if (!this.descriptor.raw) {
7474
handler = function () {}
7575
}
7676

7777
if (typeof handler !== 'function') {
78-
process.env.NODE_ENV !== 'production' && _.warn(
78+
process.env.NODE_ENV !== 'production' && warn(
7979
'v-on:' + this.arg + '="' +
8080
this.expression + '" expects a function value, ' +
8181
'got ' + handler
@@ -105,20 +105,20 @@ module.exports = {
105105
if (this.iframeBind) {
106106
this.iframeBind()
107107
} else {
108-
_.on(this.el, this.arg, this.handler)
108+
on(this.el, this.arg, this.handler)
109109
}
110110
},
111111

112-
reset: function () {
112+
reset () {
113113
var el = this.iframeBind
114114
? this.el.contentWindow
115115
: this.el
116116
if (this.handler) {
117-
_.off(el, this.arg, this.handler)
117+
off(el, this.arg, this.handler)
118118
}
119119
},
120120

121-
unbind: function () {
121+
unbind () {
122122
this.reset()
123123
}
124124
}

0 commit comments

Comments
 (0)