Closed sendking closed 2 years ago
// 去掉 __isBrowser__ 判断,会导致 dom 结构不一致
// 有相关需求用 useEffect 做二次渲染
if (path?.includes('web')) {
return <BasicLayout>
{props.children!}
</BasicLayout>
} else {
return <div style={{ backgroundColor: 'red' }}>
{props.children!}
</div>
}
这个用法是解决了如上图的问题。
但是还有个问题:
仔细读文档faq
相关代码: https://github.com/sendking/ssr-antd-demo/commit/28dccb4ef65181e645db1a5870bdae27e8f981e1
需求:根据路由去使用不同的layout
问题:在layouts文件夹中根据路由判断不同的模版,具体模版样式无法使用,提示如图错误
Warning: Prop `style` did not match. Server: "null" Client: "font-size:22px;color:red"