修复树节点插入不显示问题 #2153

This commit is contained in:
xuliangzhan
2023-08-19 11:12:50 +08:00
parent 3d800236b3
commit 5142891e8a
7 changed files with 22 additions and 15 deletions

View File

@@ -20,10 +20,10 @@ A [vue](https://www.npmjs.com/package/vue) based PC form component, support add,
* Designed for single row table editing, supports addition, deletion, modification and query as well as more expansion, with powerful functions and performance at the same time.
* Plan
* [x] ~~v1.0 Based on vue2.6 < 3, Support for all major browsers.~~
* [x] ~~v2.0 Based on vue2.6 < 3, Support for all major browsers.~~
* [x] v3.0 Based on vue2.6 < 3, supports modern browsers and retains compatibility with IE11.
* [x] v4.0 Based on vue3.2 < 4, Only support modern browser, not IE.
* [x] ~~v1.0 Based on vue2.6, Support for all major browsers.~~
* [x] ~~v2.0 Based on vue2.6, Support for all major browsers.~~
* [x] v3.0 Based on vue2.6, supports modern browsers and retains compatibility with IE11.
* [x] v4.0 Based on vue3.x, Only support modern browser, not IE.
## Browser Support

View File

@@ -20,10 +20,10 @@
* 为单行编辑表格而设计,支持增删改查及更多扩展,强大的功能的同时兼具性能
* 计划
* [x] ~~v1.0 基于 vue2.6 < 3,支持所有主流的浏览器,实现表格的一切实用的功能~~
* [x] ~~v2.0 基于 vue2.6 < 3,支持所有主流的浏览器,同时兼具功能与性能~~
* [x] v3.0 基于 vue2.6 < 3,支持现代浏览器并保留兼容 IE11
* [x] v4.0 基于 vue3.2 < 4,只支持现代浏览器,不支持 IE
* [x] ~~v1.0 基于 vue2.6,支持所有主流的浏览器,实现表格的一切实用的功能~~
* [x] ~~v2.0 基于 vue2.6,支持所有主流的浏览器,同时兼具功能与性能~~
* [x] v3.0 基于 vue2.6,支持现代浏览器并保留兼容 IE11
* [x] v4.0 基于 vue3.x,只支持现代浏览器,不支持 IE
* [ ] 下一阶段:sticky 渲染模式、将虚拟滚动提升到极致、虚拟滚动动态行高、数据图表可视化
## 浏览器支持

View File

@@ -20,10 +20,10 @@
* 為單行編輯表格而設計,支持增删改查及更多擴展,强大的功能的同時兼具效能
* 計劃
* [x] ~~v1.0 基於 vue2.6 < 3,支持所有主流的瀏覽器,實現表格的一切實用的功能~~
* [x] ~~v2.0 基於 vue2.6 < 3,支持所有主流的瀏覽器,同時兼具功能與效能~~
* [x] v3.0 基於 vue2.6 < 3,支持現代瀏覽器並保留相容IE11
* [x] v4.0 基于 vue3.2 < 4,只支持現代瀏覽器,不支持IE
* [x] ~~v1.0 基於 vue2.6,支持所有主流的瀏覽器,實現表格的一切實用的功能~~
* [x] ~~v2.0 基於 vue2.6,支持所有主流的瀏覽器,同時兼具功能與效能~~
* [x] v3.0 基於 vue2.6,支持現代瀏覽器並保留相容IE11
* [x] v4.0 基于 vue3.x,只支持現代瀏覽器,不支持IE
## 瀏覽器支持

View File

@@ -31,7 +31,7 @@
<vxe-column title="操作" width="500">
<template #default="{ row }">
<vxe-button type="text" status="primary" @click="insertRow(row, 'current')">插入节点</vxe-button>
<vxe-button type="text" status="primary" @click="insertRow(row, 'top')">顶部插入节点</vxe-button>
<vxe-button type="text" status="primary" @click="insertRow(row, 'top')">顶部插入子节点</vxe-button>
<vxe-button type="text" status="primary" @click="insertRow(row, 'bottom')">尾部插入子节点</vxe-button>
<vxe-button type="text" status="primary" @click="removeRow(row)">删除节点</vxe-button>
</template>

View File

@@ -1,6 +1,6 @@
{
"name": "vxe-table",
"version": "4.5.0",
"version": "4.5.1",
"description": "一个基于 vue 的 PC 端表单/表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、JSON 配置式为低/零代码而设计...",
"scripts": {
"update": "npm install --legacy-peer-deps",
@@ -65,7 +65,7 @@
"vue-i18n": "^9.1.7",
"vue-router": "^4.0.11",
"vuex": "^4.0.2",
"xe-utils": "^3.5.11"
"xe-utils": "^3.5.12"
},
"peerDependencies": {
"vue": "^3.2.28",

View File

@@ -76,10 +76,15 @@ const editHook: VxeGlobalHooksHandles.HookOptions = {
const parentRest = fullAllDataRowIdData[getRowid($xetable, parentRow)]
const parentLevel = parentRest ? parentRest.level : 0
let parentChilds = parentRow[childrenField]
let mapChilds = parentRow[mapChildrenField]
if (!XEUtils.isArray(parentChilds)) {
parentChilds = parentRow[childrenField] = []
}
if (!XEUtils.isArray(mapChilds)) {
mapChilds = parentRow[childrenField] = []
}
parentChilds[funcName](item)
mapChilds[funcName](item)
const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: parentChilds, parent, level: parentLevel + 1 }
fullDataRowIdData[rowid] = rest
fullAllDataRowIdData[rowid] = rest
@@ -116,6 +121,7 @@ const editHook: VxeGlobalHooksHandles.HookOptions = {
* @param {Row} row 指定行
*/
insertAt (records: any, row: any) {
debugger
const { treeConfig } = props
const { mergeList, editStore } = reactData
const { tableFullTreeData, afterFullData, tableFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData

View File

@@ -5760,6 +5760,7 @@ export default defineComponent({
const { row, column } = params
const { lazy } = treeOpts
const rowid = getRowid($xetable, row)
debugger
if (!lazy || !treeExpandLazyLoadedMaps[rowid]) {
const expanded = !tableMethods.isTreeExpandByRow(row)
const columnIndex = tableMethods.getColumnIndex(column)