axios.get() 和axios.post()

发布时间 2023-10-10 11:02:26作者: 红豆沙

    const res = await axios.get('https://applet-base-api-t.itheima.net/bill', {

      params: {

        creator: '小黑'

      }

    })

 

post请求不需要在里面嵌套data对象

 const res = await axios.post('https://applet-base-api-t.itheima.net/bill', { //不用额外配置data,直接写在对象里面
      creator: '小黑',
      name: this.name,
      price: this.price
    })