会飞的大猪
会飞的大猪
  • 发布:2020-03-21 16:45
  • 更新:2020-03-22 11:11
  • 阅读:791

uni.upload success之后拿回来的对象里有\n \"

分类:uni-app

为什么uni.upload之后拿回来的对象里有\n \",我从postman测试拿过来的是正常和,而且用urequest时候也没有这种情况
uni里

{  
    "data": "{\n   \"ok\": true,\n   \"path\": \"articleImg/release/2616f3344ba34256a404bf2d3f11e6eb.jpg\"\n}",  
    "statusCode": 200,  
    "errMsg": "uploadFile:ok"  
}  

postman里

{  
   "ok": true,  
   "path": "articleImg/release/5f3a969cba4f4040abbcb12dee4cf991.jpg"  
}
2020-03-21 16:45 负责人:无 分享
已邀请:
会飞的大猪

会飞的大猪 (作者)

for (var i = 0; i < this.imgList.length; i++) {  
                    uni.uploadFile({  
                        url:_this.apiUrl+'/article/addPic',  
                        filePath:this.imgList[i],  
                        header:{authorization:uni.getStorageSync('userToken')},  
                        name:'file',  
                        success: (res) => {  
                            console.log(res);  
                            console.log(res.data.ok);  
                            if(res.data.ok){  
                                console.log(res.data.path);  
                                this.imgUrlList.push(res.data.path);  
                                console.log(this.imgUrlList);  
                            }else{  
                                uni.showToast({  
                                    icon:'none',  
                                    title:'错误:['+i+']:'+res.data.msg  
                                })  
                                return;  
                            }  
                        }  
                    })  
                }

这是上传文件的代码

DCloud_heavensoft

DCloud_heavensoft

按模板详细说明,哪个平台、hx版本、编译模式。。。

会飞的大猪

会飞的大猪 (作者)

已经可以了。是图的问题sry

该问题目前已经被锁定, 无法添加新回复