From edb7841603492b4fec4c957946f884d99897ffe7 Mon Sep 17 00:00:00 2001 From: v-sencchen Date: Fri, 15 Apr 2022 12:38:18 +0800 Subject: [PATCH 1/2] fix SSR table ReferenceError window is not defined --- src/table/hooks/useLazyLoad.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/table/hooks/useLazyLoad.ts b/src/table/hooks/useLazyLoad.ts index a481dd6c2..bc75b9d60 100644 --- a/src/table/hooks/useLazyLoad.ts +++ b/src/table/hooks/useLazyLoad.ts @@ -19,7 +19,7 @@ export default function useLazyLoad( const isInit = ref(params.rowIndex === 0); const hasLazyLoadHolder = computed(() => params?.type === 'lazy' && !isInit.value); - const requestAnimationFrame = window.requestAnimationFrame || ((cb) => setTimeout(cb, 16.6)); + const requestAnimationFrame = (typeof window == "undefined" ? false : window.requestAnimationFrame) || ((cb) => setTimeout(cb, 16.6)); const init = () => { if (!isInit.value) { From 5a60579a733a1b4da821f93290a89d110fbf8536 Mon Sep 17 00:00:00 2001 From: codenotkey <49895922+codenotkey@users.noreply.github.com> Date: Fri, 15 Apr 2022 17:15:11 +0800 Subject: [PATCH 2/2] Update useLazyLoad.ts --- src/table/hooks/useLazyLoad.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/table/hooks/useLazyLoad.ts b/src/table/hooks/useLazyLoad.ts index bc75b9d60..0e3ad0514 100644 --- a/src/table/hooks/useLazyLoad.ts +++ b/src/table/hooks/useLazyLoad.ts @@ -19,7 +19,7 @@ export default function useLazyLoad( const isInit = ref(params.rowIndex === 0); const hasLazyLoadHolder = computed(() => params?.type === 'lazy' && !isInit.value); - const requestAnimationFrame = (typeof window == "undefined" ? false : window.requestAnimationFrame) || ((cb) => setTimeout(cb, 16.6)); + const requestAnimationFrame = (typeof window === 'undefined' ? false : window.requestAnimationFrame) || ((cb) => setTimeout(cb, 16.6)); const init = () => { if (!isInit.value) {