TypeError: Cannot read property ‘name’ of undefined
14:52:04.189 cid unmatched [object Object] at view.umd.min.js:1
14:52:04.209 TypeError: Invalid attempt to destructure non-iterable instance.
14:52:04.229 In order to be iterable, non-array objects must have a Symbol.iterator method. at view.umd.min.js:1
这个错误导致我页面布局直接乱套,最后发现问题出在页面渲染的数据上,可以检查一下for循环内是否引用了未被定义的内容(以下是我的代码)
修改前:
//before----------------------------------------------------------
<template>
<view class="atitle">
<p>{{data['sjxy'].title}}</p>
<view class="title-texOne">
<view @tap="toPath({url:sjxy.moreLink})">{{data['sjxy'].more}}</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
data:{}
}
}
}
</script>
修改后:
//after--------------------------------------------------------
<template>
<view class="atitle">
<p>{{sjxy.title}}</p>
<view class="title-texOne">
<view @tap="toPath({url:sjxy.moreLink})">{{sjxy.more}}</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
data:{},
sjxy:{}
}
}
}
</script>