diff --git a/packages/table/src/store/watcher.ts b/packages/table/src/store/watcher.ts index ade7fa682a..c6289015bb 100644 --- a/packages/table/src/store/watcher.ts +++ b/packages/table/src/store/watcher.ts @@ -1,4 +1,4 @@ -import { ref, getCurrentInstance, unref } from 'vue' +import { ref, getCurrentInstance, unref, watch } from 'vue' import { getKeysMap, getRowIdentity, @@ -68,6 +68,15 @@ function useWatcher() { const sortOrder = ref(null) const hoverRow = ref(null) + + watch( + data, + () => instance.state && scheduleLayout(false), + { + deep: true, + }, + ) + // 检查 rowKey 是否存在 const assertRowKey = () => { if (!rowKey.value) throw new Error('[ElTable] prop row-key is required')