-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (28 loc) · 759 Bytes
/
index.js
File metadata and controls
29 lines (28 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function VXEUtils (app, XEUtils, options) {
var isV3 = typeof app !== 'function'
var mounts = options && options.mounts && options.mounts.length ? options.mounts.join(';') : []
var variate = '$utils'
var setMount = function (name) {
if (mounts.indexOf(name) > -1) {
if (isV3) {
app.config.globalProperties['$' + name] = XEUtils[name]
} else {
app.prototype['$' + name] = XEUtils[name]
}
}
}
if (isV3) {
app.config.globalProperties[variate] = XEUtils
} else {
Object.defineProperty(app.prototype, variate, {
get: function () {
XEUtils.$context = this
return XEUtils
}
})
}
setMount('cookie')
setMount('browse')
setMount('locat')
}
export default VXEUtils