<script> export default { data() { return { input10: '', //请求的URL url: 'http://localhost:8080/log/loginLogs', tableData: [], currentPage: 1, total: 0, } }, created() { this.loadData(1, 10) }, methods: { //从服务器读取数据 loadData: function (pageNum, pageSize) { this.axios.get('http://localhost:8080/log/loginLogs?pageNum=1&pageSize=10') .then((response) => { console.log(response.data) this.tableData = response.data.result.list; this.total = response.data.result.count; }, response => { console.log(response); }) }, handleSizeChange(val) { console.log(`每页 ${val} 条`); }, handleCurrentChange(val) { console.log(`当前页: ${val}`); } } } </script>
axio拿到数据后怎样给它
tableData: [],
this.tableData = response.data;这样就取到了
this.tableData.push(...response.data.result.list)