配置好baseURL之后用axios请求地址依然报错成localhost?

Leon
  • 17

配置了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)
回复
阅读 1.2k
你知道吗?

宣传栏