+13
-8
| import Vue from 'vue' | ||
| import commons from './src/js/commons/commons.js' //引入公用js | ||
| import utils from './src/js/commons/commons.js' //引入公用js | ||
| import { | ||
| postJson, | ||
| postImg, | ||
| postImage, | ||
| postFile, | ||
| postData, | ||
| postForm, | ||
| get, | ||
@@ -12,8 +15,10 @@ } from "./src/js/commons/http.js"; | ||
| Vue.prototype.$commons= commons; | ||
| Vue.prototype.$postJson= postJson; | ||
| Vue.prototype.$postFile= postImg; | ||
| Vue.prototype.$postImg= postImg; | ||
| Vue.prototype.$get= get; | ||
| Vue.prototype.$test= test; | ||
| Vue.prototype.$utils = utils; | ||
| Vue.prototype.$postJson = postJson; | ||
| Vue.prototype.$postFile = postFile; | ||
| Vue.prototype.$postImage = postImage; | ||
| Vue.prototype.$postData = postData; | ||
| Vue.prototype.$postForm = postForm; | ||
| Vue.prototype.$get = get; | ||
| Vue.prototype.$test = test; | ||
@@ -20,0 +25,0 @@ |
+1
-1
| { | ||
| "name": "wapx-lib", | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", | ||
| "private": false, | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -59,3 +59,3 @@ import axios from 'axios'; | ||
| export function get(url, params = {}) { | ||
| export function getUrl(url, params = {}) { | ||
| return new Promise((resolve, reject) => { | ||
@@ -95,3 +95,3 @@ axios.defaults.timeout = 60000; | ||
| export function postJson(url, data) { | ||
| export function postJsonUrl(url, data) { | ||
| return new Promise((resolve, reject) => { | ||
@@ -115,3 +115,3 @@ axios.defaults.timeout = 15000; | ||
| export function postData(url, data) { | ||
| export function postDataUrl(url, data) { | ||
| return new Promise((resolve, reject) => { | ||
@@ -135,3 +135,3 @@ axios.defaults.timeout = 15000; | ||
| export function postForm(url, data = {}) { | ||
| export function postFormUrl(url, data = {}) { | ||
| return new Promise((resolve, reject) => { | ||
@@ -192,3 +192,3 @@ axios.defaults.timeout = 15000; | ||
| export function postImg(url, data) { | ||
| export function postFileUrl(url, data) { | ||
| return new Promise((resolve, reject) => { | ||
@@ -237,1 +237,50 @@ axios.defaults.timeout = 30000; | ||
| } | ||
| export function get(url, fn) { | ||
| getUrl(url).then(function (response) { | ||
| if (fn) { | ||
| fn(response) | ||
| } | ||
| }) | ||
| } | ||
| export function postJson(url, data, fn) { | ||
| postJsonUrl(url, data).then(function (response) { | ||
| if (fn) { | ||
| fn(response) | ||
| } | ||
| }) | ||
| } | ||
| export function postData(url, data, fn) { | ||
| postDataUrl(url, data).then(function (response) { | ||
| if (fn) { | ||
| fn(response) | ||
| } | ||
| }) | ||
| } | ||
| export function postForm(url, data, fn) { | ||
| postFormUrl(url, data).then(function (response) { | ||
| if (fn) { | ||
| fn(response) | ||
| } | ||
| }) | ||
| } | ||
| export function postImage(url, data, fn) { | ||
| postFileUrl(url, data).then(function (response) { | ||
| if (fn) { | ||
| fn(response) | ||
| } | ||
| }) | ||
| } | ||
| export function postFile(url, data, fn) { | ||
| postFileUrl(url, data).then(function (response) { | ||
| if (fn) { | ||
| fn(response) | ||
| } | ||
| }) | ||
| } |
31791
3.49%458
11.44%