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);
      });
posted on 2020-07-10 16:50  哼着老调调  阅读(316)  评论(0编辑  收藏  举报

聊天   切换waifu!  换衣服!   拍照!   许愿吧cxy