axios

作者: 未来在奋斗 | 来源:发表于2019-12-02 18:10 被阅读0次
    1. axios基本请求
    1. axios.get(url, config)
    2. axios.post(url, data, config)
    3. axios(config)
        axios({
        url:'http://123.207.32.32:8000/home/data'
        //专门针对get请求的参数拼接
        params:{
        type:'pop',
        page:1
            }
        }).then(res=>{
        console.log(res);
        }).catch(err=>{
        
        })
    
    1. axios发送并发请求同时到达了才执行
        axios.all([axios({
        url:'http://123.207.32.32:80/home/multidata'
        }),axios(
        url:'http://123.207.32.32:8000/home/data'
        params:{
        type:'get',
        page:1
            }
        )]).then(axios.spread((res1,res2)=>{
            console.log(res1)
            console.log(res2)
        }))
        ```

    相关文章

      网友评论

          本文标题:axios

          本文链接:https://www.haomeiwen.com/subject/vifqgctx.html