我有一个编辑项目按钮。单击编辑按钮,弹出一个窗口,我可以编辑这些字段。
目前一切正常,但是布局看起来很难看,因为我必须向下滚动才能单击“保存/取消”按钮。
我想调整弹出窗口,这样我就不必向下滚动。
我的编辑页HTML是:
<div class="main-content">
<div class="container-fluid">
<div class="row">
<div class="card">
<div class="card-header">
<h5 class="title">Update Project</h5>
</div>
<div class="container">
<form class="mat-dialog-content" (ngSubmit)="submit" #formControl="ngForm">
<div class="form">
<mat-form-field color="accent">
<input matInput #input class="form-control" placeholder="Project Name" [(ngModel)]="data.projectName"
name="projectName" required>
<mat-error *ngIf="formControl.invalid">{{getErrorMessage()}}</mat-error>
</mat-form-field>
</div>
<!--Textarea for demo purposes-->
<div class="form">
<mat-form-field color="accent">
<textarea matInput #input class="form-control" placeholder="Description" [(ngModel)]="data.projectDescription"
name="projectDescription" required></textarea>
<mat-error *ngIf="formControl.invalid">{{getErrorMessage()}}</mat-error>
</mat-form-field>
</div>
<div mat-dialog-actions>
<button mat-button [type]="submit" [disabled]="!formControl.valid" [mat-dialog-close]="data" (click)="stopEdit()">Save</button>
<button mat-button (click)="onNoClick()" tabindex="-1">Cancel</button>
</div>
</form>
</div>
</div>
</div>
</div>
我的CSS是:
.container {
border-radius: 4px;
box-sizing: border-box;
overflow: auto;
outline: 0;
width: 500px;
height: 250px;
min-height: inherit;
max-height: inherit;
}
.form {
display: flex;
padding-top: 6px;
}
.mat-form-field {
font-size: 16px;
flex-grow: 1;
}