vue-request发起网络数据请求

1、在cmd模式下,使用npm install vue-resource --save命令进行下载
2、在main.js文件中引用(放入位置有讲究)

3、

get方式
<script>
export  default({
  name:'Home',
  mounted:function(){

    this.$http.get("http://172.18.91.206/task/list").then(response=>{

      console.log(response.data);
    },response=>{

      console.log("error");
    });
  }
})
</script>
posted @ 2020-11-29 10:17  _远故故故故故故故故  阅读(419)  评论(0)    收藏  举报