javascript - iView中 tree 树控件 的方法调用有错
问题描述
官网的说明Tree methods
方法名说明参数getCheckedNodes获取被勾选的节点无getSelectedNodes获取被选中的节点无自己撸的代码----------------------------------
<button @click=’getCheckedNodes’>获取被选中的节点</button><button @click='getSelectedNodes'>获取被勾选的节点</button>
自己撸的代码---------------------------
getCheckedNodes(){ console.log(this.$refs.Tree.getCheckedNodes());},getSelectedNodes(){ console.log(this.$refs.tree.getSelectedNodes);}
报错
App.vue?2573:105 Uncaught TypeError: Cannot read property ’getCheckedNodes’ of undefinedat VueComponent.getCheckedNodes (eval at <anonymous> (app.js:967), <anonymous>:92:40)at boundFn (eval at <anonymous> (app.js:723), <anonymous>:125:14)at HTMLButtonElement.invoker (eval at <anonymous> (app.js:723), <anonymous>:1659:18)
问题解答
回答1:Tree组件调用上面要写上ref
<Tree :data='baseData' show-checkbox ref='tree'></Tree>
相关文章:
1. docker网络端口映射,没有方便点的操作方法么?2. docker api 开发的端口怎么获取?3. Docker for Mac 创建的dnsmasq容器连不上/不工作的问题4. docker容器呢SSH为什么连不通呢?5. 前端 - 类到底该如何去命名 .newsList 这种的命名难道真的不是过度语义化吗?~6. docker gitlab 如何git clone?7. 如何解决Centos下Docker服务启动无响应,且输入docker命令无响应?8. 请问“由于 Cookie “PHPSESSID”的“SameSite”属性设置为“None”,但缺少“Secure”属性,此 Cookie 未来将被拒绝。”请问出现这个问题怎么办?9. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?10. Hbuilder中的phpMyAdmin访问题

网公网安备