From 169c6cc4dc2acf5264fe0dea640621f35e0ec4af Mon Sep 17 00:00:00 2001 From: "TENCENT\\ivinwu" Date: Thu, 22 Nov 2018 20:54:22 +0800 Subject: [PATCH] update readme --- README.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e118bd1..d1be554 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,7 @@ weRequest.init({ // [可选] 提供接口的mock,若不需使用,请设置为false mockJson: require("../../mock.json"), // [可选] 所有请求都会自动带上globalData里的参数 - globalData: function() { + globalData: function() { return { version: getApp().version } @@ -252,7 +252,7 @@ weRequest.request({ success: function (data) { console.log(data); }, - fail: function(obj, res) { + fail: function(res) { } }) ``` @@ -277,6 +277,25 @@ weRequest.request({ |showLoading|Boolean|否|false|请求过程页面是否展示全屏的loading|是| |report|String|否||接口请求成功后将自动执行init()中配置的reportCGI函数,其中的name字段值为这里配置的值|是| +#### 示例代码 + +```javascript +wx.chooseImage({ + count: 1, + success: function (res) { + weRequest.uploadFile({ + url: 'upload/img', + filePath: res.tempFilePaths[0], + name: 'pic', + showLoading: "提交中", + success(data){ + console.log(data.imgPath); + } + }) + } +}) +``` + ### .getSession() [return String]