| {{ field.label }} @@ -28,9 +56,11 @@ export default { data() { return { loading: null, + total: 0, + length: 0, page: 0, // 현재 페이지 - perPage: 10, // 페이지당 보여줄 갯수 - // bootstrap 'b-table' 필드 설정 + perPage: 0, // 페이지당 보여줄 갯수 + searchString: '', fields: [ { key: 'id', @@ -54,17 +84,23 @@ export default { }, setup() {}, created() { - this.list() + const url = 'http://localhost:3000/todo' + this.list(url) }, mounted() {}, unmounted() {}, methods: { - async list() { - const url = 'http://localhost:3000/todo?per_page=5&page=1' + async list(url) { this.loading = null await axios.get(url).then((response) => { if (response.statusText === 'OK') { - this.rows = response.data + console.log(response) + this.page = response.data.query.page + this.per_page = response.data.query.per_page + this.searchString = response.data.query.searchString + this.total = response.data.total + this.rows = response.data.rows + this.length = response.data.rows.length } else { throw new Error(`Network response was not ok. \n url => ${url}`) } |
|---|