javascript - iView中 tree 树控件 的方法调用有错
仅有的幸福
仅有的幸福 2017-07-05 10:49:11
0
1
1831

官网的说明
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 undefined

at 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>
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!