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

是否支持SSR渲染 ? 我看到说是支持SSR, 能否给个nuxt.js的使用例子 #560

Open
MrChen0521 opened this issue Jun 2, 2022 · 4 comments

Comments

@MrChen0521
Copy link

我按照文档进行引入,然后如果我开启ssr模式,则会提示
document is not define

@oyuyue
Copy link
Owner

oyuyue commented Jun 2, 2022

你是直接在 node 环境直接 new Player 吗?应该在 mount 的时候再创建 player 实例。
nplayer 的官网就是用的 SSR。这里可以看到相关代码 https://github.com/woopen/nplayer/blob/main/website/src/pages/components/Playground/index.jsx

@axelulu
Copy link

axelulu commented Aug 19, 2022

document is not defined vite-ssg编译也抱这个,大佬能不能给个例子

@oyuyue
Copy link
Owner

oyuyue commented Aug 19, 2022

document is not defined vite-ssg编译也抱这个,大佬能不能给个例子

可以在 vite-ssg 环境下打印一下 window 和 document 对象吗? 播放器内部是通过有没有 window 对象来判断是否是 ssr 环境的

@axelulu
Copy link

axelulu commented Aug 21, 2022

多谢,我已经解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants