у вас есть идея, как получить массив строк с числами после загрузки всех данных из API. Мне нужно установить totalRows для таблицы разбивки на страницы, но
this.questions = this.questions.lenght
не работает и возвращает ноль.
export default {
data() {
return {
questions: [],
fields: [
{ key: 'id', label: 'ID', sortable: true },
{ key: 'title', label: 'Title', sortable: true },
{ key: 'updated_at', label: 'Last update', sortable: true},
],
totalRows: 13,
currentPage: 1,
perPage: 5,
pageOptions: [5, 10, 15]
}
},
components: {},
created() {
axios.get('/api/question')
.then(res => this.questions = res.data.data)
.catch(error => console.log(error.response.data))
},
}
Я дополнительно добавляю то, что возвращает мой API
questions:Array[10]
--0:Object
-----body:"Sed minima nemo fuga libero. Rerum incidunt odio voluptatem aut quidem consequuntur. Odio deserunt labore voluptatem quo aut atque nemo."
-----id:1
-----title:Object
-----updated_at:"1 tydzień temu"
-----user:"Ahmad Mills"