vue中axios的get和post

get

 this.$axios
          .get(
            "/hospital/get_by_id",
           {
             params:{
               id:this.$route.params.id
             }
           }           
          )
          .then(res => {
            console.log(res.data.data, "a");
            this.content = res.data.data;
          })
          .catch(error => {
            console.error(error);
          });

post

this.$axios
      .post(
        "/hospital/get_hospital",
        Qs.stringify({
          currentPage: "1",
          pageSize: "6",
          is_Hot: "1"
        })
      )
      .then(res => {
        console.log(res.data.data, "a");
        this.hosptialList = res.data.data.hospital.records.slice(0, 3);
       })
      .catch(error => {
        console.error(error);
      });
原文地址:https://www.cnblogs.com/caoxueyang/p/13280048.html