提示如下错误
Access to XMLHttpRequest at ‘http://localhost:8082/admin/login‘ from origin ‘htt
在vue项目当中已经设置了相关的跨域文件,但是还是不行,这里直接在后端接口设置一下就可以进行文件的上传了
/*
@author SisyphusTang
@since 2023-03-18
*/
@PostMapping("/import")
//允许跨域 value当中为跨域的值(前端端口)
@CrossOrigin(value="http://localhost:8081")
public Boolean imp(MultipartFile file) throws Exception {
//some methods here...
}