服务器报错
Access to XMLHttpRequest at ‘http://10.0.0.112:8002/simulation/emergency/getEmergencyById/1’ from origin ‘http://localhost:8090’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: The value of the ‘Access-Control-Allow-Origin’ header in the response must not be the wildcard ‘*’ when the request’s credentials mode is ‘include’. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
withCredentials: false, // 允许携带cookie
在axios里把这一条设置为false就行了,此时项目不需要携带cookie,如果需要携带cookie的话,需要后端配置
后端地址指向错误也会有类似的报错,此时就需要后端改了