fix:cannot delete control when it is first element #131

This commit is contained in:
Hufe921
2023-02-28 21:13:59 +08:00
parent b95127c5f0
commit 45ef8b6954
+2 -1
View File
@@ -243,7 +243,8 @@ export class Control {
if (nextIndex === elementList.length) {
rightIndex = nextIndex - 1
}
if (!~leftIndex || !~rightIndex) return startIndex
if (!~leftIndex && !~rightIndex) return startIndex
leftIndex = ~leftIndex ? leftIndex : 0
// 删除元素
elementList.splice(leftIndex + 1, rightIndex - leftIndex)
return leftIndex