Comparing version 1.7.2 to 2.0.0
@@ -8,50 +8,7 @@ "use strict"; | ||
function bindPromiseContext(callback, context) { | ||
return typeof callback === 'function' ? callback.bind(context) : callback; | ||
function VXEAjax(Vue, XEAjax) { | ||
Vue.prototype.$ajax = XEAjax; | ||
} | ||
function XEPromise(executor, context) { | ||
this.promise = executor instanceof Promise ? executor : new Promise(executor.bind(context)); | ||
this.context = context; | ||
} | ||
XEPromise.prototype.then = function (resolve, reject) { | ||
return new XEPromise(this.promise.then(bindPromiseContext(resolve, this.context), bindPromiseContext(reject, this.context)), this.context); | ||
}; | ||
XEPromise.prototype["catch"] = function (reject) { | ||
return new XEPromise(this.promise["catch"](bindPromiseContext(reject, this.context)), this.context); | ||
}; | ||
XEPromise.all = function (iterable, context) { | ||
return new XEPromise(Promise.all(iterable), context); | ||
}; | ||
XEPromise.race = function (reason, context) { | ||
return new XEPromise(Promise.race(reason), context); | ||
}; | ||
XEPromise.resolve = function (reason, context) { | ||
return new XEPromise(Promise.resolve(reason), context); | ||
}; | ||
XEPromise.reject = function (reason, context) { | ||
return new XEPromise(Promise.reject(reason), context); | ||
}; | ||
function VXEAjax(Vue, XEAjax, options) { | ||
if (options && (options === true || options.context === true)) { | ||
Object.defineProperty(Vue.prototype, '$ajax', { | ||
get: function get() { | ||
XEAjax.$Promise = XEPromise; | ||
XEAjax.$context = this; | ||
return XEAjax; | ||
} | ||
}); | ||
} else { | ||
Vue.prototype.$ajax = XEAjax; | ||
} | ||
} | ||
var _default = VXEAjax; | ||
exports["default"] = _default; |
@@ -13,3 +13,3 @@ (function (global, factory) { | ||
} | ||
})(this, function (_exports) { | ||
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { | ||
"use strict"; | ||
@@ -22,51 +22,8 @@ | ||
function bindPromiseContext(callback, context) { | ||
return typeof callback === 'function' ? callback.bind(context) : callback; | ||
function VXEAjax(Vue, XEAjax) { | ||
Vue.prototype.$ajax = XEAjax; | ||
} | ||
function XEPromise(executor, context) { | ||
this.promise = executor instanceof Promise ? executor : new Promise(executor.bind(context)); | ||
this.context = context; | ||
} | ||
XEPromise.prototype.then = function (resolve, reject) { | ||
return new XEPromise(this.promise.then(bindPromiseContext(resolve, this.context), bindPromiseContext(reject, this.context)), this.context); | ||
}; | ||
XEPromise.prototype["catch"] = function (reject) { | ||
return new XEPromise(this.promise["catch"](bindPromiseContext(reject, this.context)), this.context); | ||
}; | ||
XEPromise.all = function (iterable, context) { | ||
return new XEPromise(Promise.all(iterable), context); | ||
}; | ||
XEPromise.race = function (reason, context) { | ||
return new XEPromise(Promise.race(reason), context); | ||
}; | ||
XEPromise.resolve = function (reason, context) { | ||
return new XEPromise(Promise.resolve(reason), context); | ||
}; | ||
XEPromise.reject = function (reason, context) { | ||
return new XEPromise(Promise.reject(reason), context); | ||
}; | ||
function VXEAjax(Vue, XEAjax, options) { | ||
if (options && (options === true || options.context === true)) { | ||
Object.defineProperty(Vue.prototype, '$ajax', { | ||
get: function get() { | ||
XEAjax.$Promise = XEPromise; | ||
XEAjax.$context = this; | ||
return XEAjax; | ||
} | ||
}); | ||
} else { | ||
Vue.prototype.$ajax = XEAjax; | ||
} | ||
} | ||
var _default = VXEAjax; | ||
_exports["default"] = _default; | ||
}); |
@@ -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 n={exports:{}};t(n.exports),e.VXEAjax=n.exports.default}}(this,function(e){"use strict";function n(e,t){return"function"==typeof e?e.bind(t):e}function o(e,t){this.promise=e instanceof Promise?e:new Promise(e.bind(t)),this.context=t}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,o.prototype.then=function(e,t){return new o(this.promise.then(n(e,this.context),n(t,this.context)),this.context)},o.prototype.catch=function(e){return new o(this.promise.catch(n(e,this.context)),this.context)},o.all=function(e,t){return new o(Promise.all(e),t)},o.race=function(e,t){return new o(Promise.race(e),t)},o.resolve=function(e,t){return new o(Promise.resolve(e),t)},o.reject=function(e,t){return new o(Promise.reject(e),t)};function t(e,t,n){!n||!0!==n&&!0!==n.context?e.prototype.$ajax=t:Object.defineProperty(e.prototype,"$ajax",{get:function(){return t.$Promise=o,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 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){e.prototype.$ajax=t}e.default=t}); |
47
index.js
@@ -1,48 +0,5 @@ | ||
function bindPromiseContext (callback, context) { | ||
return typeof callback === 'function' ? callback.bind(context) : callback | ||
function VXEAjax (Vue, XEAjax) { | ||
Vue.prototype.$ajax = XEAjax | ||
} | ||
function XEPromise (executor, context) { | ||
this.promise = executor instanceof Promise ? executor : new Promise(executor.bind(context)) | ||
this.context = context | ||
} | ||
XEPromise.prototype.then = function (resolve, reject) { | ||
return new XEPromise(this.promise.then(bindPromiseContext(resolve, this.context), bindPromiseContext(reject, this.context)), this.context) | ||
} | ||
XEPromise.prototype.catch = function (reject) { | ||
return new XEPromise(this.promise.catch(bindPromiseContext(reject, this.context)), this.context) | ||
} | ||
XEPromise.all = function (iterable, context) { | ||
return new XEPromise(Promise.all(iterable), context) | ||
} | ||
XEPromise.race = function (reason, context) { | ||
return new XEPromise(Promise.race(reason), context) | ||
} | ||
XEPromise.resolve = function (reason, context) { | ||
return new XEPromise(Promise.resolve(reason), context) | ||
} | ||
XEPromise.reject = function (reason, context) { | ||
return new XEPromise(Promise.reject(reason), context) | ||
} | ||
function VXEAjax (Vue, XEAjax, options) { | ||
if (options && (options === true || options.context === true)) { | ||
Object.defineProperty(Vue.prototype, '$ajax', { | ||
get: function () { | ||
XEAjax.$Promise = XEPromise | ||
XEAjax.$context = this | ||
return XEAjax | ||
} | ||
}) | ||
} else { | ||
Vue.prototype.$ajax = XEAjax | ||
} | ||
} | ||
export default VXEAjax |
{ | ||
"name": "vxe-ajax", | ||
"version": "1.7.2", | ||
"version": "2.0.0", | ||
"description": "用于 Vue 全局安装 xe-ajax", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.common.js", | ||
"vue": ">=2.6.10", | ||
"xe-ajax": ">=3.7.0" | ||
"xe-ajax": ">=4.0.0" | ||
}, | ||
@@ -29,3 +29,3 @@ "devDependencies": { | ||
"@babel/runtime": "^7.4.4", | ||
"eslint": "^5.15.1", | ||
"eslint": "^5.16.0", | ||
"eslint-config-standard": "^12.0.0", | ||
@@ -38,11 +38,11 @@ "eslint-friendly-formatter": "^4.0.1", | ||
"gulp": "^4.0.2", | ||
"gulp-autoprefixer": "^6.1.0", | ||
"gulp-autoprefixer": "^7.0.1", | ||
"gulp-babel": "^8.0.0", | ||
"gulp-clean-css": "^4.2.0", | ||
"gulp-concat": "^2.6.1", | ||
"gulp-rename": "^1.4.0", | ||
"gulp-rename": "^2.0.0", | ||
"gulp-replace": "^1.0.0", | ||
"gulp-sass": "^4.0.2", | ||
"gulp-uglify": "^3.0.2", | ||
"markdown-doctest": "^0.9.1" | ||
"markdown-doctest": "^1.0.0" | ||
}, | ||
@@ -49,0 +49,0 @@ "repository": { |
# vxe-ajax | ||
[![gitee star](https://gitee.com/xuliangzhan_admin/vxe-ajax/badge/star.svg?theme=dark)](https://gitee.com/xuliangzhan_admin/vxe-ajax/stargazers) | ||
[![npm version](https://img.shields.io/npm/v/vxe-ajax.svg?style=flat-square)](https://www.npmjs.org/package/vxe-ajax) | ||
@@ -52,3 +53,3 @@ [![npm build](https://travis-ci.org/xuliangzhan/vxe-ajax.svg?branch=master)](https://travis-ci.org/xuliangzhan/vxe-ajax) | ||
created () { | ||
this.$ajax.getJSON('/api/user/list').then(list => { | ||
this.$ajax.get('/api/user/list').then(list => { | ||
this.list = data | ||
@@ -55,0 +56,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
64
6429
53