update readme

This commit is contained in:
TENCENT\ivinwu
2018-11-22 20:54:22 +08:00
parent bf93154e22
commit 169c6cc4dc

View File

@@ -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]