- 使用 v-for 去循环静态列是非常糟糕的,仅用于改变属性,需确保 key 唯一性(动态场景需使用 进行渲染)
+ 使用 v-for 去循环静态列是非常糟糕的,仅用于改变属性,需确保 key 唯一性(动态场景需使用 vxe-grid 进行渲染)
如果列信息发生变动,则需要通过调用 方法刷新列信息
(注:该用法是不建议使用,所有兼容性应自行解决,该示例仅供参考)
diff --git a/examples/views/table/edit/RealtimeSave.vue b/examples/views/table/edit/RealtimeSave.vue
index 8f9281632..eff94298c 100644
--- a/examples/views/table/edit/RealtimeSave.vue
+++ b/examples/views/table/edit/RealtimeSave.vue
@@ -1,6 +1,6 @@
-
通过监听 事件实现编辑完成即时保存功能,再配合 局部刷新函数(具体请自行实现,该示例仅供参考)
+
通过监听 事件实现编辑完成即时保存功能,再配合 局部加载行的函数,调用该方法之后,会将指定行的状态更新为初始状态,可用于局部刷新数据(具体请自行实现,该示例仅供参考)
{
+ return nextTick().then(() => {
if ($xetoolbar) {
$xetoolbar.syncUpdate({ collectColumn, $table: $xetable })
}
+ return tableMethods.recalculate()
})
}
@@ -2241,8 +2242,7 @@ export default defineComponent({
*/
loadColumn (columns) {
const collectColumn = XEUtils.mapTree(columns, column => Cell.createColumn($xetable, column))
- handleColumn(collectColumn)
- return nextTick()
+ return handleColumn(collectColumn)
},
/**
* 加载列配置并恢复到初始状态
diff --git a/packages/tooltip/src/tooltip.ts b/packages/tooltip/src/tooltip.ts
index 18200d544..353475a0d 100644
--- a/packages/tooltip/src/tooltip.ts
+++ b/packages/tooltip/src/tooltip.ts
@@ -252,9 +252,11 @@ export default defineComponent({
const { trigger } = props
const { target } = reactData
const wrapperElem = refElem.value
- const parentNode = wrapperElem.parentNode
- if (parentNode) {
- parentNode.removeChild(wrapperElem)
+ if (wrapperElem) {
+ const parentNode = wrapperElem.parentNode
+ if (parentNode) {
+ parentNode.removeChild(wrapperElem)
+ }
}
if (target) {
if (trigger === 'hover') {
diff --git a/types/plugins/pro.d.ts b/types/plugins/pro.d.ts
index e9b7f1e38..6936da349 100644
--- a/types/plugins/pro.d.ts
+++ b/types/plugins/pro.d.ts
@@ -165,11 +165,12 @@ export namespace VxeTableProDefines {
extendCols: VxeTableDefines.ColumnInfo[];
direction: ExtendCellAreaDirection;
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}
interface EventParams extends VxeEvent {
$table: VxeTableConstructor & VxeTablePrivateMethods;
- $grid: VxeGridConstructor & VxeGridPrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}
type FnrTab = 'find' | 'replace';
diff --git a/types/table.d.ts b/types/table.d.ts
index d4917f996..e3cb2aff0 100644
--- a/types/table.d.ts
+++ b/types/table.d.ts
@@ -26,7 +26,7 @@ export interface VxeTableConstructor extends VxeComponentBase, VxeTableMethods {
getComputeMaps(): TablePrivateComputed;
renderVN: RenderFunction;
- xegrid?: VxeGridConstructor | null;
+ xegrid?: VxeGridConstructor | null | undefined;
}
export interface TablePrivateRef {
@@ -1042,7 +1042,7 @@ export namespace VxeTablePropTypes {
export type FooterMethod = (params: {
$table: VxeTableConstructor & VxeTablePrivateMethods;
- $grid: VxeGridConstructor | null;
+ $grid: VxeGridConstructor | null | undefined;
columns: VxeTableDefines.ColumnInfo[];
data: any[];
}) => Array[];
@@ -1616,6 +1616,7 @@ export namespace VxeTablePropTypes {
column: VxeTableDefines.ColumnInfo;
cellValue: any;
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}): string;
/**
* 自定义单元格复制取值之前的方法,可以通过返回 false 阻止复制行为
@@ -1624,6 +1625,7 @@ export namespace VxeTablePropTypes {
isCut: boolean;
targetAreas: VxeTableProDefines.CellAreaParams[];
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}): boolean;
/**
* 自定义单元格复制到剪贴板之后的方法
@@ -1632,6 +1634,7 @@ export namespace VxeTablePropTypes {
isCut: boolean;
targetAreas: VxeTableProDefines.CellAreaParams[];
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}): boolean;
/**
* 重写单元格剪贴值清除的方法,将剪贴单元格的值清除
@@ -1641,6 +1644,7 @@ export namespace VxeTablePropTypes {
column: VxeTableDefines.ColumnInfo;
cellValue: any;
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}) => void;
/**
* 自定义单元格剪贴值清除之前的方法,可以通过返回 false 阻止清除行为
@@ -1649,6 +1653,7 @@ export namespace VxeTablePropTypes {
cutAreas: VxeTableProDefines.CellAreaParams[];
currentAreas: VxeTableProDefines.CellAreaParams[];
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}) => boolean;
/**
* 自定义单元格剪贴值清除之后的方法
@@ -1657,6 +1662,7 @@ export namespace VxeTablePropTypes {
cutAreas: VxeTableProDefines.CellAreaParams[];
currentAreas: VxeTableProDefines.CellAreaParams[];
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}) => void;
/**
* 重写单元格粘贴赋值的方法,从剪贴板赋值到单元格
@@ -1667,6 +1673,7 @@ export namespace VxeTablePropTypes {
column: VxeTableDefines.ColumnInfo;
cellValue: any;
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}): void;
/**
* 自定义单元格粘贴赋值之前的方法,可以通过返回 false 阻止复制行为
@@ -1676,6 +1683,7 @@ export namespace VxeTablePropTypes {
targetAreas: VxeTableProDefines.CellAreaParams[];
cellValues: any[][];
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}): boolean;
/**
* 自定义单元格粘贴赋值之后的方法
@@ -1688,6 +1696,7 @@ export namespace VxeTablePropTypes {
insertRows: any[];
insertColumns: VxeTableDefines.ColumnInfo[];
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}): boolean;
/**
* 只对 isRowIncrement 有效,自定义创建自增行数据的方法
@@ -1699,6 +1708,7 @@ export namespace VxeTablePropTypes {
pasteCells: string[][];
insertRows: any[];
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}): any[];
/**
* 只对 isColumnIncrement 有效,自定义创建自增列配置的方法
@@ -1710,6 +1720,7 @@ export namespace VxeTablePropTypes {
pasteCells: string[][];
insertColumns: VxeTableDefines.ColumnOptions[];
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}): VxeTableDefines.ColumnOptions[];
}
export interface ClipOpts extends ClipConfig { }
@@ -1731,12 +1742,14 @@ export namespace VxeTablePropTypes {
isAll: boolean;
findValue: string | null;
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}): boolean;
afterFindMethod?(params: {
isAll: boolean;
findValue: string | null;
result: VxeTableProDefines.FindAndReplaceResult[];
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}): void;
isReplace?: boolean;
replaceMethod?: (params: {
@@ -1749,6 +1762,7 @@ export namespace VxeTablePropTypes {
findValue: string | null;
replaceValue: string;
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}) => boolean;
afterReplaceMethod?: (params: {
isAll: boolean;
@@ -1756,6 +1770,7 @@ export namespace VxeTablePropTypes {
replaceValue: string;
result: VxeTableProDefines.FindAndReplaceResult[];
$table: VxeTableConstructor & VxeTablePrivateMethods;
+ $grid: VxeGridConstructor | null | undefined;
}) => void;
}
export interface FNROpts extends FNRConfig { }