tdesign-mobile-vue
Version:
tdesign-mobile-vue
31 lines (23 loc) • 929 B
JavaScript
/**
* tdesign v1.7.0
* (c) 2024 TDesign Group
* @license MIT
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
function swapDragArrayElement(data, currentIndex, targetIndex) {
var newData = _toConsumableArray__default["default"](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;
}
exports["default"] = swapDragArrayElement;
//# sourceMappingURL=swapDragArrayElement.js.map