Vue3_ _axios部分文章修改

174 阅读1分钟

post请求

this.axios.post(
"接口地址",
"参数名1=参数值1&参数名2=参数值2"
).then(result=>{
console.log(result)
})

post请求

this.axios.get(
"接口地址",{
params:{
    参数名1:参数值1
    参数名2:参数值2"
   }
}

).then(result=>{
console.log(result)
})

动态数据data

   const api={
      函数名:function(){
          return this.axios.get("接口"+"参数名")
      }
       函数名1:function(){
          return this.axios.post("接口"+"参数名")
      }
    
   }
    export default=api