javascript - iView中 tree 樹控件 的方法調(diào)用有錯
問題描述
官網(wǎng)的說明Tree methods
方法名說明參數(shù)getCheckedNodes獲取被勾選的節(jié)點無getSelectedNodes獲取被選中的節(jié)點無自己擼的代碼----------------------------------
<button @click=’getCheckedNodes’>獲取被選中的節(jié)點</button><button @click='getSelectedNodes'>獲取被勾選的節(jié)點</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組件調(diào)用上面要寫上ref
<Tree :data='baseData' show-checkbox ref='tree'></Tree>
相關(guān)文章:
1. docker images顯示的鏡像過多,狗眼被亮瞎了,怎么辦?2. 關(guān)于docker下的nginx壓力測試3. nignx - docker內(nèi)nginx 80端口被占用4. android - 百度地圖加載完成監(jiān)聽5. dockerfile - [docker build image失敗- npm install]6. java - 阿里的開發(fā)手冊中為什么禁用map來作為查詢的接受類?7. 在windows下安裝docker Toolbox 啟動Docker Quickstart Terminal 失敗!8. docker網(wǎng)絡(luò)端口映射,沒有方便點的操作方法么?9. macos - mac下docker如何設(shè)置代理10. dockerfile - 我用docker build的時候出現(xiàn)下邊問題 麻煩幫我看一下
