本地环境上传图片正常,部署到云主机上就会出错
VM1844:1 thirdScriptError
Unexpected token in JSON at position 0;at api uploadFile success callback function
SyntaxError: Unexpected token in JSON at position 0
at JSON.parse (<anonymous>)
at success (http://127.0.0.1:25900/appservice/pages/test/test3.js:269:38)
at Function.o.(anonymous function) (http://127.0.0.1:25900/appservice/dev/WAService.js:1:11
代码如下:
success: (uploadFileRes) => {
//uploadFileRes = JSON.parse(uploadFileRes.data);
console.log(uploadFileRes);
uploadFileRes = JSON.parse(uploadFileRes.data);
console.log(uploadFileRes);
if (uploadFileRes.status != 'ok') {
console.log(uploadFileRes);
uni.showToast({
title: "上传图片失败,请重试!",
icon: "none"
});
return false;
}
麻烦问下,为什么本地环境和云主机上会出现不同的情况,我应该怎么来处理呢
1 个回复
6***@qq.com - 1111111111111
我也遇到这个问题了