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. ddos - apache日志很多其它網址,什么情況?2. 怎么在phpstudy中用phpexcel上傳數據到MYSQL?3. javascript - 百度搜索網站,如何讓搜索結果顯示一張圖片加上一段描述,如圖;求教4. 二維數組怎么重新組合5. docker綁定了nginx端口 外部訪問不到6. laravel+CRUDBooster操作過程中偶爾會自動登出7. php由5.3升級到5.6后,登錄網站,返回的是php代碼,不是登錄界面,各位大神有知道的嗎?8. javascript - 如何在同一臺電腦上配置不同主機的2個git賬號?9. 發現了多個名稱為[spring_web]的片段。相對順序不合法10. android - 使用vue.js進行原生開發如何進行Class綁定
