问题:Uncaught runtime errors:ERROR Network Error AxiosError: Network Error at XMLHttpRequest.handleError (webpack-internal:///./node_modules/axios/lib/adapters/xhr.js:160:14)
解决:在Controller类上加上@CrossOrigin注解
java
/**解决跨域问题*/
@CrossOrigin
@RestController
@RequestMapping("/score")
public class StudentController {
@Autowired
StudentService studnetService;
@GetMapping("/list")
public AjaxResult studentList(){
List<Student> list = studnetService.studentList();
return AjaxResult.success(list);
}
}