【sprintboot+vue3】解决前后端分离项目遇到的问题

目录

一、Access to XMLHttpRequest at 'http://127.0.0.1:8088/api/hello' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

二、报错[@vue/compiler-sfc]


一、Access to XMLHttpRequest at 'http://127.0.0.1:8088/api/hello' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

报错:

原因:来自一个IP端口的页面(前端项目),要访问另一个IP端口的资源(springboot请求接口),会产生跨域访问。跨域问题导致的。

解决:

【sprintboot+vue3】解决前后端分离项目遇到的问题_第1张图片

二、报错[@vue/compiler-sfc]

你可能感兴趣的:(java,vue.js,前端,javascript)