md-dialog size Material for Angular 2 疑难解答
md-dialog size Material for Angular 2 troubleshooting
当我打开 Material 对话框 (MdDialog.open(MyDialogComponent)
) 时,打开的对话框会占据我屏幕的整个高度。
当我在 Chrome 检查器中从 .md-dialog-container
中删除 height:100%
时,高度被调整以完美适合内容。
但是md-dialog的源代码让它看起来像是故意的:
md-dialog-container {
...
// The dialog container should completely fill its parent overlay element.
width: 100%;
height: 100%;
...
}
我已经从我的项目中删除了 Angular 1 的 Material 以避免 CSS 与 Angular 2 的 Material 冲突。(旧的css 也使宽度过大。)
什么可能导致此问题或我该如何解决?
我的对话框组件很简单:
<h2 md-dialog-title>...</h2>
<md-dialog-content>
...
</md-dialog-content>
<md-dialog-actions align="end">
<button... />
</md-dialog-actions>
我的页面丢失了<!DOCTYPE html>
https://github.com/angular/material2/issues/2351
有关对话框的更多信息,请参阅此答案:
当我打开 Material 对话框 (MdDialog.open(MyDialogComponent)
) 时,打开的对话框会占据我屏幕的整个高度。
当我在 Chrome 检查器中从 .md-dialog-container
中删除 height:100%
时,高度被调整以完美适合内容。
但是md-dialog的源代码让它看起来像是故意的:
md-dialog-container {
...
// The dialog container should completely fill its parent overlay element.
width: 100%;
height: 100%;
...
}
我已经从我的项目中删除了 Angular 1 的 Material 以避免 CSS 与 Angular 2 的 Material 冲突。(旧的css 也使宽度过大。)
什么可能导致此问题或我该如何解决?
我的对话框组件很简单:
<h2 md-dialog-title>...</h2>
<md-dialog-content>
...
</md-dialog-content>
<md-dialog-actions align="end">
<button... />
</md-dialog-actions>
我的页面丢失了<!DOCTYPE html>
https://github.com/angular/material2/issues/2351
有关对话框的更多信息,请参阅此答案: