diff --git a/components/layout/Sider.tsx b/components/layout/Sider.tsx index b7df748fa..56de94a15 100644 --- a/components/layout/Sider.tsx +++ b/components/layout/Sider.tsx @@ -111,6 +111,8 @@ export default defineComponent({ return responsiveHandlerRef.value!(mql); } const uniqueId = generateId('ant-sider-'); + siderHook && siderHook.addSider(uniqueId); + onMounted(() => { if (typeof window !== 'undefined') { const { matchMedia } = window; @@ -124,7 +126,6 @@ export default defineComponent({ responsiveHandler(mql); } } - siderHook && siderHook.addSider(uniqueId); }); onBeforeUnmount(() => { try {