The weekend is the time to add knowledge, with the React Axios cross the problem, it seems to be a little more trouble than Vue
It does not seem to be a problem to request HTTP , but https still has a cross-domain problem.
I'm just using the Create-react-app react project, and you have to make sure that NPM run eject is running,
Expose your webpack, okay. Then configure the following in Package.json:
Of course, it's at the end of the line.
"Proxy": { "/*": {"target": "Https://douban.uieee.com" ,true } }
This has not resolved the spanning issue and must also be judged in the Axios file creation request:
Import Axios from ' Axios 'Let baseUrl= ' https://douban.uieee.com ';if(Process.env.NODE_ENV = = = ' Development ')) {BaseUrl= ' http://localhost:3000 ';} Else { //baseUrl = ' http://localhost:3000 ';}//Export Const BASEURL = ' http://localhost:3000 ';Let $axios =axios.create ({baseurl:baseurl+ '/v2/movie ', timeout:10000, Responsetype:' JSON ', headers: {' Content-type ': ' application/x-www-form-urlencoded; Charset=utf-8 ', }});
I'm combining Promise request data so you can solve cross-region problems, formal environment is configured formal environment.
Well, July, hope July to me better, continue to refuel!
React Axios cross-domain issues