Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: BottomSheet, Calendar, Popup, Slider, Tabs, Toast 这些组件中使用了 window 对象,在服务端渲染时会报错。 #32

Open
jeremy-zhao opened this issue Oct 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jeremy-zhao
Copy link

模块

stdf (STDF 组件)

版本

No response

描述缺陷

BottomSheet, Calendar, Popup, Slider, Tabs, Toast 这些组件中使用了 window 对象
SSR时,服务端没有 window 对象,导致空引用异常

复现

目前,在使用这些组件时,不得不加上 {#if browser}。

你的想法

建议您使用 css calc,尽量规避使用 window 对象。或者在 onMount 钩子中提取诸如 window.innerHeight 的值。

@jeremy-zhao jeremy-zhao added the bug Something isn't working label Oct 25, 2024
@dufu1991
Copy link
Member

目前 STDF 还不支持服务端渲染,后续整体考虑新增。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants