当页面打开一个或多个drawer时,用户点其它菜单或点击浏览器后退按钮,这些已打开的drawer需要一次性全关闭掉
希望提供一个closeAll事件,在根页面监听路由变化,可关闭所有drawer,如下代码
constructor(
private router: Router,
private drawerService: NzDrawerService
) {
router.events.subscribe(event => {
if (event instanceof NavigationStart) {
this.drawerService.closeAll();
}
});
}
Translation of this issue:
When the page opens one or more drawers, the user clicks on another menu or clicks the browser back button. These opened drawers need to be closed all at once.
I hope to provide a closeAll event, listen for routing changes in the root page, you can close all drawers, as shown below
Constructor(
Private router: Router,
Private drawerService: NzDrawerService
) {
Router.events.subscribe(event => {
If (event instanceof NavigationStart) {
this.drawerService.closeAll();
}
});
}
@HsuanXyz 您好,我还想问下,drawer能否提供像modal那样在nzOnCancel中提供阻止modal关闭的方法,因为在大部分填写表单的场景下,用户如果改变了表单内容,需要询问用户是否保存之后再关闭drawer

@HsuanXyz Modal也应该提供同样的方法
closeAll
select 和 DatePicker 类似下拉的那个面板 如何关闭?求解...
方法
modal 有closeAll()
Most helpful comment
Translation of this issue:
drawer Can provide global events, such as: closeAll
What problem does this feature solve?
When the page opens one or more drawers, the user clicks on another menu or clicks the browser back button. These opened drawers need to be closed all at once.
What does the proposed API look like?
I hope to provide a closeAll event, listen for routing changes in the root page, you can close all drawers, as shown below