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);
      });

vue中axios的get和post

上一篇:移动端页面开发前准备工作+vue添加动态路由


下一篇:UIWebView 需改userAgent 并且加载微信公共账号