【发布时间】:2021-12-20 00:04:20
【问题描述】:
这是我的 component.html 文件:
<div class="button">
<button (click)="openPopUp()" mat-button class="readBtn">Buy Now</button>
</div>
这就是 .ts 文件。
openPopUp() {
const dialogConfig = new MatDialogConfig();
dialogConfig.disableClose = true;
dialogConfig.autoFocus = true;
dialogConfig.width="60%";
this.dialog.open(GetBuyDetailsComponent, dialogConfig);
}
单击按钮时,我将打开名为 GetBuyDetails 的 Mat 对话框。但是这个 GetBuyDetails Pop-up 或 Mat Dialog 没有响应,因为它的宽度总是 60%。如何使 Mat Dialog 组件具有响应性。
【问题讨论】:
-
我不太明白你的问题。你能提供更多细节吗?据我了解和复制,它是响应式的——这意味着它的宽度始终为实际屏幕尺寸的 60%。你想达到什么目标?或者您能否提供您的 css 文件 - 正如我看到的按钮有一个
readBtn类 - 如果那里有一些覆盖,这可能是问题。 -
@vazsonyidl 是的,它总是有 60% 的宽度,这在小屏幕上看起来很可怕,所以我想要的是在较小的屏幕上宽度从 60% 变为 80%。我想实现这一目标。
标签: css angular typescript angular-material