{"action":"created","issue":{"url":"https://api.github.com/repos/ElemeFE/element/issues/10687","repository_url":"https://api.github.com/repos/ElemeFE/element","labels_url":"https://api.github.com/repos/ElemeFE/element/issues/10687/labels{/name}","comments_url":"https://api.github.com/repos/ElemeFE/element/issues/10687/comments","events_url":"https://api.github.com/repos/ElemeFE/element/issues/10687/events","html_url":"https://github.com/ElemeFE/element/issues/10687","id":313646331,"number":10687,"title":"[Feature Request] tree's node-drag-end event, increase the cancellation function, and the drag and drop can be canceled after judgment","user":{"login":"shaofing","id":21122388,"avatar_url":"https://avatars3.githubusercontent.com/u/21122388?v=4","gravatar_id":"","url":"https://api.github.com/users/shaofing","html_url":"https://github.com/shaofing","followers_url":"https://api.github.com/users/shaofing/followers","following_url":"https://api.github.com/users/shaofing/following{/other_user}","gists_url":"https://api.github.com/users/shaofing/gists{/gist_id}","starred_url":"https://api.github.com/users/shaofing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaofing/subscriptions","organizations_url":"https://api.github.com/users/shaofing/orgs","repos_url":"https://api.github.com/users/shaofing/repos","events_url":"https://api.github.com/users/shaofing/events{/privacy}","received_events_url":"https://api.github.com/users/shaofing/received_events","type":"User","site_admin":false},"labels":[{"id":813676949,"url":"https://api.github.com/repos/ElemeFE/element/labels/component:%20tree","name":"component: tree","color":"0e8a16","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-04-12T09:28:43Z","updated_at":"2018-04-19T11:26:11Z","closed_at":"2018-04-19T11:26:11Z","author_association":"NONE","body":"<!-- generated by https://eleme-issue.surge.sh DO NOT REMOVE -->\r\n\r\n### Existing Component\r\n是\r\n\r\n### Component Name\r\nTree\r\n\r\n### Description\r\ntree 的 node-drag-end 事件  ，增加取消功能，，判断后可已取消此次拖拽\r\n现有的allowDrop 不能满足适用需求，比如一层二次不能加节点，但是二层可以加子节点（三层）\r\n一层的allowDrop 设为false, 二层的 allowDrop 设为true, 但是可以通过 二层的 before，after  来增加二层，相当于一层的inner\r\n\r\n<!-- generated by https://eleme-issue.surge.sh DO NOT REMOVE -->\r\n"},"comment":{"url":"https://api.github.com/repos/ElemeFE/element/issues/comments/382700660","html_url":"https://github.com/ElemeFE/element/issues/10687#issuecomment-382700660","issue_url":"https://api.github.com/repos/ElemeFE/element/issues/10687","id":382700660,"user":{"login":"Leopoldthecoder","id":10095631,"avatar_url":"https://avatars0.githubusercontent.com/u/10095631?v=4","gravatar_id":"","url":"https://api.github.com/users/Leopoldthecoder","html_url":"https://github.com/Leopoldthecoder","followers_url":"https://api.github.com/users/Leopoldthecoder/followers","following_url":"https://api.github.com/users/Leopoldthecoder/following{/other_user}","gists_url":"https://api.github.com/users/Leopoldthecoder/gists{/gist_id}","starred_url":"https://api.github.com/users/Leopoldthecoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Leopoldthecoder/subscriptions","organizations_url":"https://api.github.com/users/Leopoldthecoder/orgs","repos_url":"https://api.github.com/users/Leopoldthecoder/repos","events_url":"https://api.github.com/users/Leopoldthecoder/events{/privacy}","received_events_url":"https://api.github.com/users/Leopoldthecoder/received_events","type":"User","site_admin":false},"created_at":"2018-04-19T11:26:11Z","updated_at":"2018-04-19T11:26:11Z","author_association":"MEMBER","body":"#10792 给 `allow-drop` 添加了第三个参数，代表当前节点是放置在目标节点之前、之内还是之后。\r\n\r\n具体到你的场景，为了达到一级不能增加子节点的目的，可以：\r\n```js\r\nallowDrop(draggingNode, dropNode, type) {\r\n  if (dropNode.parent.data.label === '一级') { // 如果目标节点是二级节点\r\n    return type === 'inner'; // 则只允许插入至目标节点内部\r\n  }\r\n  // 其他逻辑\r\n}\r\n```"}}
{"actor":{"display_login":"Leopoldthecoder"}}