在React中 使用yz-open-sdk-nodejs开发的时候,报以下的错误
Failed to load https://open.youzan.com/api/entr ... d5c7ac4bafbec873ef:
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' 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.
开发代码:
export default class OnLineShop extends React.Component {
componentDidMount() {
const data3=new YZClient(new YZSign(YZConfig.client_id,YZConfig.client_secret)).
invoke('youzan.shop.basic.get', '3.0.0', 'GET', {},undefined);
console.log(data3);
}
render() {
return (
<div>
data
</div>
)
}
}大佬、这种情况怎么解决?
|
|
用手机打开
收藏
赞 0
···
回复
|
|
|
|