Comparing version 2.0.1 to 2.1.0
@@ -8,9 +8,15 @@ "use strict"; | ||
function VXEAjax(Vue, XEAjax) { | ||
Object.defineProperty(Vue.prototype, '$ajax', { | ||
get: function get() { | ||
XEAjax.$context = this; | ||
return XEAjax; | ||
} | ||
}); | ||
function VXEAjax(app, XEAjax) { | ||
var isV3 = typeof app !== 'function'; | ||
if (isV3) { | ||
app.config.globalProperties.$ajax = XEAjax; | ||
} else { | ||
Object.defineProperty(app.prototype, '$ajax', { | ||
get: function get() { | ||
XEAjax.$context = this; | ||
return XEAjax; | ||
} | ||
}); | ||
} | ||
} | ||
@@ -17,0 +23,0 @@ |
@@ -21,9 +21,15 @@ (function (global, factory) { | ||
function VXEAjax(Vue, XEAjax) { | ||
Object.defineProperty(Vue.prototype, '$ajax', { | ||
get: function get() { | ||
XEAjax.$context = this; | ||
return XEAjax; | ||
} | ||
}); | ||
function VXEAjax(app, XEAjax) { | ||
var isV3 = typeof app !== 'function'; | ||
if (isV3) { | ||
app.config.globalProperties.$ajax = XEAjax; | ||
} else { | ||
Object.defineProperty(app.prototype, '$ajax', { | ||
get: function get() { | ||
XEAjax.$context = this; | ||
return XEAjax; | ||
} | ||
}); | ||
} | ||
} | ||
@@ -30,0 +36,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){if("function"==typeof define&&define.amd)define("vxe-ajax",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var f={exports:{}};t(f.exports),e.VXEAjax=f.exports.default}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;function t(e,t){Object.defineProperty(e.prototype,"$ajax",{get:function(){return t.$context=this,t}})}e.default=t}); | ||
!function(e,t){if("function"==typeof define&&define.amd)define("vxe-ajax",["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var o={exports:{}};t(o.exports),e.VXEAjax=o.exports.default}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;function t(e,t){"function"!=typeof e?e.config.globalProperties.$ajax=t:Object.defineProperty(e.prototype,"$ajax",{get:function(){return t.$context=this,t}})}e.default=t}); |
19
index.js
@@ -1,10 +0,15 @@ | ||
function VXEAjax (Vue, XEAjax) { | ||
Object.defineProperty(Vue.prototype, '$ajax', { | ||
get: function () { | ||
XEAjax.$context = this | ||
return XEAjax | ||
} | ||
}) | ||
function VXEAjax (app, XEAjax) { | ||
var isV3 = typeof app !== 'function' | ||
if (isV3) { | ||
app.config.globalProperties.$ajax = XEAjax | ||
} else { | ||
Object.defineProperty(app.prototype, '$ajax', { | ||
get: function () { | ||
XEAjax.$context = this | ||
return XEAjax | ||
} | ||
}) | ||
} | ||
} | ||
export default VXEAjax |
{ | ||
"name": "vxe-ajax", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "用于 Vue 全局安装 xe-ajax", | ||
@@ -20,3 +20,2 @@ "main": "dist/index.common.js", | ||
"peerDependencies": { | ||
"vue": ">=2.6.10", | ||
"xe-ajax": ">=4.0.0" | ||
@@ -23,0 +22,0 @@ }, |
@@ -33,3 +33,10 @@ # vxe-ajax | ||
// use: | ||
Vue.use(VXEAjax, XEAjax) | ||
// vue2.x: | ||
// Vue.prototype.$ajax = XEAjax | ||
// vue3.x: | ||
// app.config.globalProperties.$ajax = XEAjax | ||
``` | ||
@@ -54,4 +61,4 @@ | ||
created () { | ||
this.$ajax.get('/api/user/list').then(list => { | ||
this.list = data | ||
this.$ajax.get('/api/user/list').then(data => { | ||
this.list = data | ||
}) | ||
@@ -58,0 +65,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7375
1
83
71