huodoushigemi / wc-flow-layout

High performance waterfall layout written using web components
MIT License
161 stars 17 forks source link

是否可以支持ssr #8

Open Lisheri opened 8 months ago

Lisheri commented 8 months ago

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

huodoushigemi commented 8 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')