@netang/quasar 0.1.22 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils/$tree.js +10 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "netang-quasar",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/utils/$tree.js CHANGED
@@ -570,9 +570,18 @@ function create(options) {
570
570
  const moveLists = []
571
571
 
572
572
  // 当前拖拽节点在新列表中的索引
573
- const dropIndex = $n_findIndex(children, e => e.id === draggingNode.id)
573
+ let dropIndex = $n_findIndex(children, e => e.id === draggingNode.id)
574
574
  if (dropIndex > -1) {
575
575
 
576
+ if (
577
+ // 如果拖拽到目标节点下方
578
+ dropType === 'bottom'
579
+ // 并且拖拽节点当前的位置不是第一个
580
+ && dropIndex > 0
581
+ ) {
582
+ dropIndex--
583
+ }
584
+
576
585
  for (let i = dropIndex; i < children.length; i++) {
577
586
  const { attr } = children[i]
578
587
  attr.sort = i + 1