1
I need to get the reference of the selected item on TreeView
of iView
, I’ve tried with getSelectedNodes()
but it seems that the method is not being used properly, and the documentation does not help much...
var Main = {
data () {
return {
data1: [
{
title: 'parent 1',
expand: false,
children: [
{
title: 'parent 1-1',
expand: false,
children: [
{
title: 'leaf 1-1-1'
},
{
title: 'leaf 1-1-2'
}
]
},
{
title: 'parent 1-2',
expand: false,
children: [
{
title: 'leaf 1-2-1'
},
{
title: 'leaf 1-2-1'
}
]
}
]
}
]
}
},
methods : {
getSelectedNodes (el) {
console.log(el);
}
}
}
var Component = Vue.extend(Main)
new Component().$mount('#app')
@import url("//unpkg.com/iview/dist/styles/iview.css");
#app{padding: 32px;}
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/iview/dist/iview.min.js"></script>
<div id="app">
<tree :data="data1"></tree>
</div>
If possible, I would also like to know, how can I instantiate an event of click
for each item.
Apart: comments here or there that part of the documentation you find insufficient for us to improve.
– Sergio
@Sergio, congratulations on the project, in relation to documentation, I found it vague in the session
TreeView
and I may be wrong but where is the methodon-select-change
the title is as 'Tree Events' andgetCheckedNodes
under the title 'Tree methods',getCheckedNodes
I was putting inmethods
, andon-select-change
imagined as a directive...– Felipe Duarte