search

Home  >  Q&A  >  body text

javascript - The method call of the tree control in iView is wrong

Official website description
Tree methods

Method name illustrate parameter
getCheckedNodes Get the checked node none
getSelectedNodes Get the selected node none

My own code----------------------------------

<button @click='getCheckedNodes'>获取被选中的节点</button>
<button @click="getSelectedNodes">获取被勾选的节点</button>

My own code---------------------------

getCheckedNodes(){
    console.log(this.$refs.Tree.getCheckedNodes());
},
getSelectedNodes(){
    console.log(this.$refs.tree.getSelectedNodes);
}

Error reporting

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)
仅有的幸福仅有的幸福2797 days ago1918

reply all(1)I'll reply

  • 阿神

    阿神2017-07-05 10:51:11

    Tree component call should be written with ref

    <Tree :data="baseData" show-checkbox ref="tree"></Tree>

    reply
    0
  • Cancelreply