VUE报错errorHandler TypeError: Cannot read property 'forEach' of undefined

1错误提示

[system] errorHandler TypeError: Cannot read property 'forEach' of undefined
    at Proxy.render (index.umd.min.js:1)
    at VueComponent.Vue._render (vue.runtime.esm.js:4624)
    at VueComponent.updateComponent (vue.runtime.esm.js:2829)
    at Watcher.get (vue.runtime.esm.js:3201)
    at new Watcher (vue.runtime.esm.js:3189)
    at mountComponent (vue.runtime.esm.js:2836)
    at VueComponent../node_modules/@dcloudio/vue-cli-plugin-uni/packages/h5-vue/dist/vue.runtime.esm.js.Vue.$mount (vue.runtime.esm.js:8098)
    at init (vue.runtime.esm.js:4207)
    at createComponent (vue.runtime.esm.js:5686)
    at createElm (vue.runtime.esm.js:5633) VueComponent {_uid: 29, _isVue: true, $options: Object, _renderProxy: Proxy, _self: VueComponent…} render

出现这个错误是因为异步数据未加载进来的时候视图部分先渲染了。

1解决办法——异步数据的for循环前加个if判断:比如v-if="data.length"

意思是:只要数组存在就可以执行渲染。

你可能感兴趣的:(VUE报错errorHandler TypeError: Cannot read property 'forEach' of undefined)