huodoushigemi / wc-flow-layout

High performance waterfall layout written using web components
MIT License
153 stars 18 forks source link

是否可以支持ssr #8

Open Lisheri opened 6 months ago

Lisheri commented 6 months ago

nuxt3引入需要额外配置吗?document以及HTMLElement在SSR阶段没有, 但是我看案例中又支持

huodoushigemi commented 6 months ago

https://github.com/huodoushigemi/wc-flow-layout?tab=readme-ov-file#-use-in-ssr

导入方式改为动态导入即可

- import 'wc-waterfall'
+ if (typeof document != 'undefined') import('wc-waterfall')