tdesign-mobile-vue
Version:
tdesign-mobile-vue
23 lines (19 loc) • 621 B
JavaScript
/**
* tdesign v1.9.3
* (c) 2025 TDesign Group
* @license MIT
*/
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
function swapDragArrayElement(data, currentIndex, targetIndex) {
var newData = _toConsumableArray(data);
if (targetIndex - currentIndex > 0) {
newData.splice(targetIndex + 1, 0, newData[currentIndex]);
newData.splice(currentIndex, 1);
} else {
newData.splice(targetIndex, 0, newData[currentIndex]);
newData.splice(currentIndex + 1, 1);
}
return newData;
}
export { swapDragArrayElement as default };
//# sourceMappingURL=swapDragArrayElement.js.map