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

eleTree组件拖动节点时判断是否超出边界的代码有问题 #92

Open
muyunzhongtian opened this issue Jan 8, 2020 · 6 comments

Comments

@muyunzhongtian
Copy link

场景描述:页面上有两棵树,两棵树均允许节点拖动
操作描述:拖动一棵树的节点到另一棵树上
期望结果:被拖动的节点不会添加到另一棵树上
实际结果:被拖动的节点添加到另一棵树上
结论:eleTree组件拖动节点时判断是否超出边界的代码有问题

image

jquery的parents()方法传入的参数应该是选择器(也就是字符串),而options.elem此时已经是对象了,导致 target.parents(options.elem).length===0 条件不成立,不能return

@hsiangleev
Copy link
Owner

@muyunzhongtian 多谢提醒,之前没太注意到,修改之后通过获取节点的属性组成字符串查找

@muyunzhongtian
Copy link
Author

@muyunzhongtian 多谢提醒,之前没太注意到,修改之后通过获取节点的属性组成字符串查找

建议使用:target.parents(options.elem.selector).length===0 进行判断

@muyunzhongtian
Copy link
Author

muyunzhongtian commented Jan 9, 2020 via email

@hsiangleev
Copy link
Owner

@muyunzhongtian 额,谢谢,我感觉应该有这个api,找了半天没找到,就自己拼接选择器了。。。

@muyunzhongtian
Copy link
Author

muyunzhongtian commented Jan 9, 2020 via email

@hsiangleev
Copy link
Owner

@muyunzhongtian 哪里哪里,大神这个词叫的我有点慌。。。

  1. 同级节点的上下排序这个通过拖拽目前也能实现,因为每次拖拽的时候都会把那个节点移动到同级的最后一个节点,例如1这个节点下面有ABCD四个子节点,把A拖拽到1上面,子节点顺序就会变为BCDA了
  2. 单选的话,因为目前感觉多选还有一些问题没有解决,比如现在执行一些方法之后,手动选择的节点会被清除,而且自从上次大修改之后增加了好多的功能,代码越来越多感觉有点驾驭不住了。。。

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