// renderToString
try {
initView = renderToString(
<Provider store={store}>
<StaticRouter location={location} context={context}>
{renderRoutes(routes)}
</StaticRouter>
</Provider>
);
console.log('lzr======');
console.log(initView);
console.log('lzr======');
}
运行它,得到如下的initView:
<div data-reactroot=""><div></div><div><div class="common-side-bar"><a href="/"><div class="bar-top"></div></a><div class="pandect"><span class="icon-pandest"></span>some thing</div><div class="menu"><ul style="width:180px" class="ant-menu ant-menu-inline ant-menu-dark ant-menu-root" role="menu" aria-activedescendant="" tabindex="0"><li class="ant-menu-submenu-inline ant-menu-submenu"><div style="padding-left:24px" class="ant-menu-submenu-title" aria-expanded="false" aria-owns="iot$Menu" aria-haspopup="true"><span><i class="icon-iothub common-icon">....
我做了initView.indexOf(&#39;检查&#39;)并获得-1。任何人都可以给我一个帮助,谢谢。