axios之ajax请求

page(currentPage) {
       const _this = this
       axios.get('http://localhost:8080/book/findAll/' + currentPage + '/6').then(function (resp) {
         _this.tableData = resp.data.content
         _this.total = resp.data.totalElements
       })

  与

    async page(currentPage) {
      const {data:res}=await this.$http.get('http://localhost:8080/book/findAll/' + currentPage + '/6')
console.log(res)
      this.tableData=res.content;
      this.total=res.totalElements

是一样的,太溜了。

posted @ 2020-11-12 00:44  能借我十块钱吗  阅读(107)  评论(0编辑  收藏  举报