0
    // 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('check') 并得到-1。谁能帮帮我,谢谢。

4

1 回答 1

0

我发现这个pullrequest删除了 data-reactid 和 data-react-checksum。

于 2018-11-22T02:38:12.360 回答