diff --git a/package.json b/package.json index c31b68f74c..8a6d59fa9a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "vxe-table", - "version": "3.8.4", + "name": "vxe-table-ycjlazy", + "version": "3.8.4-ycj-beta", "description": "一个基于 vue 的 PC 端表单/表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、JSON 配置式...", "scripts": { "update": "npm install --legacy-peer-deps", @@ -88,8 +88,8 @@ "vue grid" ], "author": { - "name": "Xu Liangzhan", - "email": "xu_liangzhan@163.com" + "name": "Yuan Chengjie", + "email": "1210611769@qq.com" }, "license": "MIT", "bugs": { diff --git a/packages/edit/src/mixin.js b/packages/edit/src/mixin.js index fa9016a738..47725d9e42 100644 --- a/packages/edit/src/mixin.js +++ b/packages/edit/src/mixin.js @@ -28,7 +28,10 @@ function insertTreeRow (_vm, newRecords, isAppend) { mapChilds = parentRow[childrenField] = [] } parentChilds[funcName](item) - mapChilds[funcName](item) + // 在开启懒加载的情况下,首次 insert row 会导致重复添加 + if (mapChilds !== parentChilds) { + mapChilds[funcName](item) + } const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1 } fullDataRowIdData[rowid] = rest fullAllDataRowIdData[rowid] = rest @@ -126,7 +129,10 @@ function handleInsertRowAt (_vm, records, row, isInsertNextRow) { if (isInsertNextRow) { targetIndex = targetIndex + 1 } - parentChilds.splice(targetIndex, 0, ...newRecords) + // 在开启懒加载的情况下,首次 insert row 会导致重复添加 + if (parentChilds !== parentMapChilds) { + parentChilds.splice(targetIndex, 0, ...newRecords) + } } } } else {