Помогите пожалуйста розобраться в том, как передать данные с масива в шаблон Vue по API
Ecть контроллер в Laravel:
{
// Этот вариант выводит шаблоне Vue!!!
// return Load::latest()->get();
// Этот нет! Выводиться только в консоле.
return $view_loads = [Load::latest()->get(), Route::latest()->get()];
}
как хочу вывести:
``` <table class="table">
<thead v-for="load in loads">
<tr>
<th scope="col">{{ load.name }}</th>
<th scope="col"></th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
</table>
<table class="table">
<tbody>
<tr>
<th scope="row">1</th>
<td>load</td>
</tr>
</tbody>
</table>```
import axios from 'axios';
export default {
mounted() {
this.fetchData()
},
data () {
return {
loads: []
// routes: []
}
},
methods: {
fetchData () {
axios.get('/api/loads/')
.then((response) => {
// this.routes = response.data
this.loads = response.data
console.log(response)
})
.catch((err) => {
console.log(err)
})
}
}
}```
//Проблемма в том что я не могу вивести ```{{ load.name }}```