diff --git a/.eslintrc.js b/.eslintrc.js index ae1ee675110f88f12d610a5cb5316e2c5e6e5cf0..7e1f9968f47541631551b23650aab15d2471b5e3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -80,5 +80,6 @@ module.exports = { caughtErrorsIgnorePattern: '^_' } ], + 'no-undef-init': 'error', }, }; \ No newline at end of file diff --git a/packages/opendesign/src/table/useTableMeta.ts b/packages/opendesign/src/table/useTableMeta.ts index 2bad88c8f0b277160a9a445e4172a9d47a308abc..8f061f63e6e7a5e162b0d5aac27f584b6b1493e7 100644 --- a/packages/opendesign/src/table/useTableMeta.ts +++ b/packages/opendesign/src/table/useTableMeta.ts @@ -164,7 +164,7 @@ function markSection( } } } -function markTable(sections: Array, options: TableMetaOptions) { +function markTable(sections: Array, options: TableMetaOptions) { const { markCellLastCol, markCellLastRow, markRowLast, splitBySection } = options; const marker = { cellColMarker: markCellLastCol === true ? DEFAULT_CELL_LAST_COL_MARKER : markCellLastCol, @@ -180,8 +180,8 @@ function markTable(sections: Array, options: TableMeta }); } const processTable = (el: HTMLTableElement, cellMap: WeakMap, options: TableMetaOptions) => { - let head = undefined; - let foot = undefined; + let head = null; + let foot = null; let maxCols = 0; // 处理表格数据 if (el.tHead) { @@ -247,9 +247,9 @@ function shouldRefactorTableMeta(records: MutationRecord[]) { } export function useTableMeta(elRef: HTMLTableElement | Ref, options: TableMetaOptions = {}) { const cellMap = new WeakMap(); - const head = shallowRef(); - const bodies = shallowRef(); - const foot = shallowRef(); + const head = shallowRef(null); + const bodies = shallowRef([]); + const foot = shallowRef(null); let mutationObserver: MutationObserver | null = null; const updateMeta = (el: HTMLTableElement) => {