I'm integrating MDL into a React application.
I've just tried to make a component out of a Fixed Header layout (http://www.getmdl.io/components/index.html#layout-section) and noticed that if I hardcode the layout in the html it works as expected. However if i generate that html at runtime with JS the hamburger icon is missing.
What should I do to fix that problem?
When you add an element after dom is already loaded you'll need to 'upgrade' the element. To do so dom-wide, try this snippet
componentHandler.upgradeDom();
I have a similar problem. It seems that in this case need to re-create layout. https://github.com/google/material-design-lite/blob/master/src/layout/layout.js#L286
来源:https://stackoverflow.com/questions/31296803/rerendering-mdl-drawer-menu-makes-drawer-button-disappear