javascript - iView中 tree 樹控件 的方法調(diào)用有錯(cuò)
問題描述
官網(wǎng)的說明Tree methods
方法名說明參數(shù)getCheckedNodes獲取被勾選的節(jié)點(diǎn)無getSelectedNodes獲取被選中的節(jié)點(diǎn)無自己擼的代碼----------------------------------
<button @click=’getCheckedNodes’>獲取被選中的節(jié)點(diǎn)</button><button @click='getSelectedNodes'>獲取被勾選的節(jié)點(diǎn)</button>
自己擼的代碼---------------------------
getCheckedNodes(){ console.log(this.$refs.Tree.getCheckedNodes());},getSelectedNodes(){ console.log(this.$refs.tree.getSelectedNodes);}
報(bào)錯(cuò)
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. linux - 【已解決】fabric部署的Python項(xiàng)目Apache啟動(dòng)之后提示403Forbidden該如何解決?2. python - (初學(xué)者)代碼運(yùn)行不起來,求指導(dǎo),謝謝!3. mysql里的大表用mycat做水平拆分,是不是要先手動(dòng)分好,再配置mycat4. window下mysql中文亂碼怎么解決??5. python - flask sqlalchemy signals 無法觸發(fā)6. nginx - pip install python庫報(bào)錯(cuò)7. python - 獲取到的數(shù)據(jù)生成新的mysql表8. python的文件讀寫問題?9. javascript - js 對(duì)中文進(jìn)行MD5加密和python結(jié)果不一樣。10. 為什么python中實(shí)例檢查推薦使用isinstance而不是type?
