We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
1:通过JSONP来解决跨域问题,不过这个需要对方服务器做相应的处理。 例如: function jsonp(urlObj, callback) { let url = urlObj.url, callbackName = urlObj.jsonpCallback;
window[callbackName] = function(data) { window[callbackName] = undefined; document.body.removeChild(script); callback(data); }; let script = document.createElement('script'); script.src = url; document.body.appendChild(script);
}
2:常用强力解决办法,打开你的webpack devserver 通过这个进行代理配置 例如: devServer: { headers: { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS", "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization" }, proxy: { '/OAAccount': { target: REMOTE_URL, secure: false, changeOrigin: true } } } 详情请参考webpack devserver 文档 https://webpack.js.org/configuration/dev-server/#devserver-proxy
3: 最简单的方法, 服务端将cross-origin:*这样设置一下即可,需服务端主动配置
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: