Skip to content

Commit 3eac9a8

Browse files
committed
Expose version, warn about incompatible Vue version
1 parent 7c9f20c commit 3eac9a8

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

index.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { util } from 'vue';
1+
import Vue from 'vue';
2+
3+
export var version = '1.1.3';
4+
5+
var compatible = (/^1\./).test(Vue.version);
6+
if (!compatible) {
7+
Vue.util.warn('VueClickaway ' + version + ' only supports Vue 1.x, and does not support Vue ' + Vue.version);
8+
}
29

310
export var directive = {
411

@@ -8,7 +15,7 @@ export var directive = {
815
update: function(handler) {
916
if (typeof handler !== 'function') {
1017
if (process.env.NODE_ENV !== 'production') {
11-
util.warn(
18+
Vue.util.warn(
1219
this.name + '="' +
1320
this.expression + '" expects a function value, ' +
1421
'got ' + handler
@@ -33,11 +40,11 @@ export var directive = {
3340
}
3441
};
3542

36-
util.on(document.documentElement, 'click', this.handler);
43+
Vue.util.on(document.documentElement, 'click', this.handler);
3744
},
3845

3946
reset: function() {
40-
util.off(document.documentElement, 'click', this.handler);
47+
Vue.util.off(document.documentElement, 'click', this.handler);
4148
},
4249

4350
unbind: function() {

0 commit comments

Comments
 (0)