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. debian - docker依赖的aufs-tools源码哪里可以找到啊?2. dockerfile - 为什么docker容器启动不了?3. angular.js - angular内容过长展开收起效果4. html5 - node静态资源服务器设置了Cache-Control,但浏览器从来不走3045. docker内创建jenkins访问另一个容器下的服务器问题6. 对html实现监测 发现不对7. docker - 各位电脑上有多少个容器啊?容器一多,自己都搞混了,咋办呢?8. 为什么我ping不通我的docker容器呢???9. 如何下载网站里面的图片?10. android - Apk 中找不到r类文件

网公网安备