我有此数据
userPlaces: []
此功能在安装组件时运行
getUserPlaces: function () {
axios.get('/user/places').then(response => {
this.userPlaces = response.data
})
},
并显示此项目列表
<v-list-item v-for="place in userPlaces" :key="place.id">
<v-list-item-title><a style="font-weight: bold;" class="dropdown-item menu-text"
@click="placeDialog(place)">{{place.name}}</a></v-list-item-title>
</v-list-item>
我遇到2个错误:无法读取null的属性“ length”
完全错误
app.js:113641 [Vue warn]: Error in render: "TypeError: Cannot read property 'length' of null"
found in
---> <RegisterComponent> at resources/js/components/RegisterComponent.vue
<Root>
warn @ app.js:113641
logError @ app.js:114900
globalHandleError @ app.js:114895
handleError @ app.js:114855
Vue._render @ app.js:116560
updateComponent @ app.js:117074
get @ app.js:117485
run @ app.js:117560
flushSchedulerQueue @ app.js:117318
(anonymous) @ app.js:114996
flushCallbacks @ app.js:114922
Promise.then (async)
timerFunc @ app.js:114949
nextTick @ app.js:115006
queueWatcher @ app.js:117410
update @ app.js:117550
notify @ app.js:113752
reactiveSetter @ app.js:114077
proxySetter @ app.js:117637
(anonymous) @ app.js:7067
Promise.then (async)
getUserPlaces @ app.js:7066
mounted @ app.js:6798
invokeWithErrorHandling @ app.js:114870
callHook @ app.js:117227
insert @ app.js:116153
invokeInsertHook @ app.js:119348
patch @ app.js:119565
Vue._update @ app.js:116953
updateComponent @ app.js:117074
get @ app.js:117485
Watcher @ app.js:117474
mountComponent @ app.js:117081
./node_modules/vue/dist/vue.common.dev.js.Vue.$mount @ app.js:122051
./node_modules/vue/dist/vue.common.dev.js.Vue.$mount @ app.js:124951
Vue._init @ app.js:118019
Vue @ app.js:118085
./resources/js/app.js @ app.js:180487
__webpack_require__ @ app.js:20
0 @ app.js:181502
__webpack_require__ @ app.js:20
(anonymous) @ app.js:84
(anonymous) @ app.js:87
为什么显示此错误,我真的什么也没想,当我删除功能时,两个错误都消失了,当我删除项目列表1时,错误消失了。