在控制器中 响应正常200
return = CustomerRequest :: with('item')-> paginate(5);
在模型课程中
public function item()
{
return $this->belongsTo('App\Item');
}
在Vuejs模板中
`data() {
columns: {},
},
methods: {
getData(){
axios.get('/api/customerRequest')
.then(response => {
this.colums = response.data;
});
}
}`
<tr v-for="column in columns" :key="column.id">
<td>{{column.id}}</td>
<td>{{column.item.title}}</td>
...
</tr>
it say : TypeError: "column.item is null"
答案 0 :(得分:0)
设置this.columns
时具有类型。
更新以下位置的this.colums = response.data;
methods: {
getData(){
axios.get('/api/customerRequest').then(response => {
this.columns = response.data;
});
}