配置了baseURI之后,`
Vue.config.productionTip = false
import axios from 'axios'
Vue.prototype.axios = axios
axios.defaults.baseURI = 'http://127.0.0.1:8888/api/private/v1'
然后添加点击事件获取地址:
login(){
this.$refs.loginFormRef.validate( valid=>{
if(!valid) return;
this.axios.post('login',this.LoginForm).then(result=>{
console.log(result)
})
/* const result = await this.$http.post('login',this.LoginForm)
console.log(result)*/
})
}
报错是 POST http://localhost:8080/login 404 (Not Found)
是
baseURL
,不是baseURI