有赞新零售社区

发帖
API使用问题»React+Axios+JSONP跨域问题

React+Axios+JSONP跨域问题

addf15cabb00 2018-08-13 1996 浏览 0 评论 | 只看楼主 [打印]
在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>
        )
    }

}大佬、这种情况怎么解决?


用手机打开
收藏 ··· 回复
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    复制链接
    新浪微博
    QQ空间
    微信扫码
    • 回复

    • 评分

    客服工作时间是9:00-18:00,客服妹子当前不在线,若不能及时回复请谅解。试试右上角的搜索吧,论坛有丰富的经验贴、公告贴,相信一定能够帮到您~

    复制成功