javascript - iView中 tree 樹(shù)控件 的方法調(diào)用有錯(cuò)
問(wèn)題描述
官網(wǎng)的說(shuō)明Tree methods
方法名說(shuō)明參數(shù)getCheckedNodes獲取被勾選的節(jié)點(diǎn)無(wú)getSelectedNodes獲取被選中的節(jié)點(diǎn)無(wú)自己擼的代碼----------------------------------
<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)
問(wèn)題解答
回答1:Tree組件調(diào)用上面要寫(xiě)上ref
<Tree :data='baseData' show-checkbox ref='tree'></Tree>
相關(guān)文章:
1. IOS app應(yīng)用軟件的id號(hào)怎么查詢?比如百度貼吧的app-id=4779278132. spring-mvc - spring-session-redis HttpSessionListener失效3. 運(yùn)行python程序時(shí)出現(xiàn)“應(yīng)用程序發(fā)生異常”的內(nèi)存錯(cuò)誤?4. 利用IPMI遠(yuǎn)程安裝centos報(bào)錯(cuò)!5. 在mac下出現(xiàn)了兩個(gè)docker環(huán)境6. 淺談Vue使用Cascader級(jí)聯(lián)選擇器數(shù)據(jù)回顯中的坑7. javascript - 在 model里定義的 引用表模型時(shí),model為undefined。8. javascript - 最近用echarts做統(tǒng)計(jì)圖時(shí)遇到兩個(gè)問(wèn)題!!9. mysql - 查詢 修改數(shù)據(jù)庫(kù)優(yōu)化問(wèn)題吧10. java - Spring boot 讀取 放在 jar 包外的,log4j 配置文件,系統(tǒng)有創(chuàng)建日志文件,不寫(xiě)入日志信息。

網(wǎng)公網(wǎng)安備