官網的說明
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)
Tree元件呼叫上面要寫上ref