layui数据请求跨域解决办法
1、浏览器控制台错误代码
浏览器端口:5500
服务器端口:8080
Access to XMLHttpRequest at'http://localhost:8080/user/findAllUsers?page=1&limit=15'
from origin 'http://127.0.0.1:5500'
has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
2、解决办法
在Java添加以下注解即可
@CrossOrigin(origins = "*") //允许所有域名访问