-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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例子,发现有个问题 #303
Comments
问题在哪里? SSR 好像都这么操作的,渲染相同的内容,然后由 JavaScript 决定是由哪个 Component 来渲染。 |
这样导致有时候,js还没运行,显示的是服务端渲染出来的Component ,然后在跳转到相应路由的Component ,会闪烁一下 |
同构,你可以试一下代码,我这边是有这个问题的,不同路由服务端也只能渲染根路由组件 |
ok,我找时间试试。 |
好的,谢谢解惑 |
我是这么测的,这边console出来都是 “/”路径的代码,希望有时间一定要试下,实例的代码都没动过,就改了一行 console。 (因为怕你不懂我问的什么,所以啰嗦一下,劳烦大神了) function renderFullPage(html, initialState) {
return `
< !DOCTYPE html >
<html >
< head >< meta charset = "utf-8" / >< link rel = "stylesheet"href = "/static/index.css" / >< /head >
< body >
< div id="root" >
< div >
${html}
< /div >
< /div >
< script >
console.log('${html}');
window.__INITIAL_STATE__ = ${JSON.stringify(initialState)};
< /script >
<script src = "/static/index.js" > </script>
< /body >
< /html >
`
} |
大神这个问题能目前能解决吗,着急用。。。 |
抱歉,在外开会,要下周才能看了。。 |
已找到问题并在本地解决,还需想 dva 层的 API 如何加,下周修复。 |
好的,3q |
试了一下,是会出现这个问题,现在修复了吗 |
同问. 我也发现这个问题了. |
已修复,改动见这个 Commit 。sorrycc/dva-boilerplate-isomorphic@149e9a7 |
有没有egg2.0+dva2.0同构的打算? |
看到你上面这个例子 https://github.com/sorrycc/dva-boilerplate-isomorphic, "/about" 渲染的还是“/”的html; 就是说不管路由跳到哪只能服务端渲染根路由
The text was updated successfully, but these errors were encountered: