【发布时间】:2019-05-01 15:30:36
【问题描述】:
我想使用drawer。我编写了基本代码,这样当用户单击导航按钮时,drawer.open 会被切换(即 true、false、true、false、...)。但是,如果用户通过单击抽屉菜单中的链接进入其他页面并通过单击浏览器的后退按钮返回,则drawer.open为true并且用户无法单击浏览器的导航按钮。
- 用户打开页面:
drawer.open=false。 - 用户点击导航按钮:
drawer.open=true。 - 用户点击菜单中的链接:
drawer.open=false在新页面中。 - 用户点击浏览器的返回按钮并返回:
drawer.open=true。
为什么drawer.open=true 在 4. 中?我该如何解决这个问题?
【问题讨论】:
-
改用
drawer.open = !drawer.open。请参阅stackoverflow.com/questions/52731777/… 的示例
标签: javascript html mdc-components