无法使用组件 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 的情况呢?
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.