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. javascript - immutable配合react提升性能?2. javascript - sublime快鍵鍵問題3. phpstudy8.1支持win11系統嗎?4. 配置Apache時,添加對PHP的支持時語法錯誤5. vue.js - Vue 如何像Angular.js watch 一樣監聽數據變化6. css - 寫頁面遇到個布局問題,求大佬們幫解答,在線等,急!~7. 實現bing搜索工具urlAPI提交8. javascript - nodejs關于進程間發送句柄的一點疑問9. Apache 已經把網站根目錄的改為allow from all了,但是服務器還是不能訪問?10. javascript - 移動端上不能實現拖拽布局嗎?

網公網安備