You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
第一种场景(即复现步骤里描述场景和代码):这种场景下有chrome的network调试窗口上有json数据返回
Failed to load http://localhost/t.json: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:10086' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
(index):1
Uncaught (in promise) TypeError: Failed to fetch
根据上一种场景错误提示,当增加Taro.request()参数mode: 'no-cors',时报错如下:
index.js?3a5f:83 Uncaught (in promise) SyntaxError: Unexpected end of input
at eval (index.js?3a5f:83)
并且,依然弹出错误Toast。这种场景下有chrome的network调试窗口上有json数据返回
问题描述
在Ubuntu上,Taro.request()请求json数据发送后,没有执行success()回调。
复现步骤
{ name: "a", OK : "true" }
期望行为
期望能够Toast.request()能够成功,回调success() 函数,并且获得数据,弹出Toast,显示"success"
报错信息
第一种场景(即复现步骤里描述场景和代码):这种场景下有chrome的network调试窗口上有json数据返回
Failed to load http://localhost/t.json: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:10086' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
(index):1
Uncaught (in promise) TypeError: Failed to fetch
根据上一种场景错误提示,当增加Taro.request()参数mode: 'no-cors',时报错如下:
index.js?3a5f:83 Uncaught (in promise) SyntaxError: Unexpected end of input
at eval (index.js?3a5f:83)
并且,依然弹出错误Toast。这种场景下有chrome的network调试窗口上有json数据返回
后来我又在场景二基础上,修改dataType: 'html',这次弹出Toast,显示success(回调了success()函数,但是返回的data却是NULL。console上没有任何错误信息提示。
系统信息
Taro v1.3.0-beta.3
Taro CLI 1.3.0-beta.3 environment info:
System:
OS: Linux 4.13 Ubuntu 17.10 (Artful Aardvark)
Shell: 4.4.12 - /bin/bash
Binaries:
Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
报错平台:h5
补充信息
场景二应该是OK的场景,但是不知道为什么显示SyntaxError
The text was updated successfully, but these errors were encountered: