How to click the node to get the data of each node in the development scenario
zhanjunhao opened this issue · 10 comments
So let's say I want to click and get the data for each node how do I extend that by just adding the click event
Tree(:data="data" draggable crossTree)
div(slot-scope="{data, store, vm}" @click="yourmethod(data)")
//- data is node
//- store is the tree
//- vm is node Vue instance, you can get node level by vm.level
template(v-if="!data.isDragPlaceHolder")
b(v-if="data.children && data.children.length" @click="store.toggleOpen(data)") {{data.open ? '-' : '+'}}
span {{data.text}}thank you I see 😄
那个 添加了@click="yourmethod(data)" 获取当前节点数据 时 我想解析当前节点的数据 但是该对象 还在遍历循环中 控制台报错:Uncaught TypeError: Converting circular structure to JSON
那个 添加了@click="yourmethod(data)" 获取当前节点数据 时 我想解析当前节点的数据 但是该对象 还在遍历循环中 控制台报错:Uncaught TypeError: Converting circular structure to JSON
use tree.pure
// with children
div(slot-scope="{data, store, vm}" @click="yourmethod(store.pure(data, true))")
// without children
div(slot-scope="{data, store, vm}" @click="yourmethod(store.pure(data))")ok, you are good!
Tree events change Event the third parameter oldTree returns null and does not fetch the oldTree structure
Tree events change Event the third parameter oldTree returns null and does not fetch the oldTree structure
old tree exists when drag cross tree
What kind of situation is the existence of the old tree can not try out
https://github.com/phphe/vue-draggable-nested-tree/blob/master/src/components/DraggableTreeNode.vue#L61
check the source code, line 61 to 68
O I see