在 react-router 中,当我更改路由器时,Material design lite(MDL) 不起作用

In react-router, when I change a router, Material design lite(MDL) doesn't work

https://www.youtube.com/watch?v=byUS_CUBELk&feature=youtu.be

我上传了视频来解决我的问题。

当您观看第 23~26 秒部分时,您可以看到 material 设计正在运行!

但是,当你观看27~30秒的部分时,你可以看到material设计不行了!

我该如何解决?

为什么换路由会出现这个问题??

帮帮我~:)

我认为你的问题是当你切换路由时你的 MDL 元素没有正确升级。这通常在您的应用程序首次加载时发生,但如果您没有在组件上的 componentDidUpdate 函数内部使用 componentHandler.upgradeDom();,则可能不会在更改路由时发生。

这篇文章很好地解释了这个问题:

http://quaintous.com/2015/07/09/react-components-with-mdl/