diff --git a/src/components/grid/DataGrid.vue b/src/components/grid/DataGrid.vue index b061678b2..2b76091a3 100644 --- a/src/components/grid/DataGrid.vue +++ b/src/components/grid/DataGrid.vue @@ -2151,12 +2151,31 @@ function onDdlResizeEnd() { window.removeEventListener("mouseup", onDdlResizeEnd); } +const loadingElapsed = ref(0); +let _loadingTimer: ReturnType | undefined; +let _loadingStart = 0; + +watch( + () => props.loading, + (isLoading) => { + clearInterval(_loadingTimer); + if (isLoading) { + _loadingStart = Date.now(); + loadingElapsed.value = 0; + _loadingTimer = setInterval(() => { + loadingElapsed.value = Date.now() - _loadingStart; + }, 100); + } + }, +); + onUnmounted(() => { if (resetScrollFrame) cancelAnimationFrame(resetScrollFrame); if (cancelScrollRestoreFrame) cancelAnimationFrame(cancelScrollRestoreFrame); onDdlResizeEnd(); finishCellSelection(); clearTimeout(_searchTimer); + clearInterval(_loadingTimer); }); const SQL_KEYWORDS = @@ -2442,7 +2461,7 @@ defineExpose({
-
+
+
+
+ + {{ (loadingElapsed / 1000).toFixed(1) }}s +
+