Comparing version 1.0.5 to 1.0.6
14
index.js
@@ -0,9 +1,11 @@ | ||
import * as ajax from '../xe-ajax' | ||
/** | ||
* Install VxeAjax | ||
*/ | ||
function plugin (Vue, func) { | ||
var constructor = func.ajax | ||
function plugin (Vue, methods) { | ||
ajax.mixin(methods) | ||
var XEAjax = ajax.constructor | ||
Object.defineProperty(Vue, 'ajax', function () { | ||
constructor.context = window | ||
return constructor | ||
XEAjax.context = window | ||
return XEAjax | ||
}) | ||
@@ -13,4 +15,4 @@ Object.defineProperties(Vue.prototype, { | ||
get () { | ||
constructor.context = this | ||
return constructor | ||
XEAjax.context = this | ||
return XEAjax | ||
} | ||
@@ -17,0 +19,0 @@ } |
{ | ||
"name": "vxe-ajax", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "vxe-ajax 基于Vue全局安装xe-ajax", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,10 +12,27 @@ # vxe-ajax 基于Vue全局安装xe-ajax | ||
import Vue from 'vue' | ||
import XEAjax from 'xe-ajax' | ||
import VXEAjax from 'vxe-ajax' | ||
Vue.use(VXEAjax, XEAjax) | ||
Vue.use(VXEAjax) | ||
// 在Vue实例中使用 | ||
this.$ajax.getJSON ('url', {id: 1}).then(data => { | ||
data | ||
}).catch(data => { | ||
data | ||
}) | ||
``` | ||
### 支持自定义扩展 | ||
``` shell | ||
import Vue from 'vue' | ||
import VXEAjax from 'vxe-ajax' | ||
import customs from './customs' // ./customs.js export function custom1 () {} | ||
Vue.use(VXEAjax, customs) | ||
// 调用自定义扩展函数 | ||
this.$ajax.custom1() | ||
``` | ||
## License | ||
Copyright (c) 2017-present, Xu Liangzhan |
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
2853
21
37