ssr-server icon indicating copy to clipboard operation
ssr-server copied to clipboard

祯民哥,有个问题,比如我Home用客户端路由跳转到Demo,结果初始数据为pending,能怎么解决呢

Open liyunfu1998 opened this issue 1 year ago • 0 comments

祯民哥,目前我的想法是利用客户端渲染和服务器端渲染的路由区别,来实现,某些特定页面是服务器端渲染,但是目前代码首次进入Home页面就会触发异步请求,导致第一次就会通过server注水state为{content: 'pending'} , 试了很多方式,比如routerMap的时候,只有item.path===当前path的时候才添加进routerMap,但是如果这样的话,服务端渲染跳转到Demo的时候,拿到的又是pending结果,而不是接口返回的结果

Home跳Demo的时候用的useNavigate()

liyunfu1998 avatar Feb 21 '24 02:02 liyunfu1998