【发布时间】:2020-04-15 12:41:34
【问题描述】:
我在 Angular 中创建了自定义对话框。对话框的当前行为是用户只能点击对话框内的按钮。
对话框.component.html
<div class="modal">
<div class="modal-body">
<ng-template #content></ng-template>
</div>
对话框.component.css
.modal {
display: block;
position: absolute;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
}
.modal-body{
position: relative;
padding: 10px;
border: 1px solid;
width: 50%;
min-width: 50%;
top: 100px;
left: 0px;
}
我想实现一种行为,我想在对话框外启用点击:
对话框内的按钮(关闭按钮)和对话框外的按钮(单击我按钮)可单击。
对话框外的链接(点击此处打开新模式)可点击
我想要一个通用的解决方案,它应该适用于对话框内外的每次点击(按钮、链接、文本等)。请帮我解决这个问题。
Stackblitz 演示:https://stackblitz.com/edit/dialog-box-overlay
【问题讨论】:
标签: javascript css angular typescript