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
是一样的,太溜了。