Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to click the node to get the data of each node in the development scenario #61

Open
zhanjunhao opened this issue Mar 5, 2019 · 10 comments

Comments

@zhanjunhao
Copy link

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

@phphe
Copy link
Owner

phphe commented Mar 5, 2019

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}}

@zhanjunhao
Copy link
Author

thank you I see 😄

@zhanjunhao
Copy link
Author

那个 添加了@click="yourmethod(data)" 获取当前节点数据 时 我想解析当前节点的数据 但是该对象 还在遍历循环中 控制台报错:Uncaught TypeError: Converting circular structure to JSON

@phphe
Copy link
Owner

phphe commented Mar 7, 2019

那个 添加了@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))")

@zhanjunhao
Copy link
Author

ok, you are good!

@zhanjunhao
Copy link
Author

Tree events change Event the third parameter oldTree returns null and does not fetch the oldTree structure

@phphe
Copy link
Owner

phphe commented Mar 7, 2019

Tree events change Event the third parameter oldTree returns null and does not fetch the oldTree structure

old tree exists when drag cross tree

@zhanjunhao
Copy link
Author

What kind of situation is the existence of the old tree can not try out

@phphe
Copy link
Owner

phphe commented Mar 13, 2019

@zhanjunhao
Copy link
Author

O I see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants