vue 에서 CORS 도메인 해결
Posted by Albert 924Day 4Hour 50Min 6Sec ago [2022-10-09]
1vue.config.js 수정
module.exports = {
devServer: {
proxy: 'http://localhost:8080' // tomcat 주소 사용
}
};
2. 사용시 톰캣주소제외하고 local처럼 사용하면됨
예 tomcat주소: http://localhost:8888/getList 일시 vue 에서 그냥 앞부분 제외하고 /getList 로 사용하면 됨
mounted() {this.$axios.get("/getList").then(res => {console.log(res.data);})}