javascript - iView中 tree 樹​​控制項 的方法呼叫有錯
仅有的幸福
仅有的幸福 2017-07-05 10:49:11
0
1
1832

官網的說明
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 undefined

at 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>
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!