无法使用组件 checklist,报错信息:
TypeError: Cannot read property 'length' of undefined
at Proxy.render (eval at <anonymous> (build.js:805), <anonymous>:9092:46)
at VueComponent.Vue._render (eval at <anonymous> (build.js:768), <anonymous>:2216:22)
at VueComponent.updateComponent (eval at <anonymous> (build.js:768), <anonymous>:2609:21)
at Watcher.get (eval at <anonymous> (build.js:768), <anonymous>:2934:27)
at new Watcher (eval at <anonymous> (build.js:768), <anonymous>:2926:12)
at VueComponent.Vue._mount (eval at <anonymous> (build.js:768), <anonymous>:2608:19)
at VueComponent.Vue$3.$mount (eval at <anonymous> (build.js:768), <anonymous>:6178:15)
at VueComponent.Vue$3.$mount (eval at <anonymous> (build.js:768), <anonymous>:8549:16)
at init (eval at <anonymous> (build.js:768), <anonymous>:1740:11)
at createComponent (eval at <anonymous> (build.js:768), <anonymous>:4174:9)
我在仓库搜这个 issue,有三个跟我一样的问题,可惜只有问题描述就都关闭了。 从报错信息看,是有个变量(应该就是) undefined 却用到了。而且这个变量应该就是 checklist 绑定用到的数组。
<mt-checklist
title=""
v-model="item_answer"
:options="choices_item">
</mt-checklist>
choices_item 是一个 computed。想问问懂的大佬,为什么会出现 undefined 的情况呢?