報錯
- 配置BaseUrl 找到目錄(src->main.js)
Axios.defaults.baseURL = '/api';
- 配置代理 找到目錄(config->index.js)
'/api':{
target: ' ', //自己的域名
changeOrigin: true, //是否跨域
pathRewrite: {
'^/api': '' //需要rewrite重寫的
}
}
- 在使用axios修改一下url
created (){
this.$axios.post('/openapi/api',{
}).then(res=>{
console.log(res);
})
},
- 需要重新啓動項目,ok啦