公共表格组件-title传null隐藏头部显示

This commit is contained in:
禾几海
2020-07-10 23:15:05 +08:00
parent 8a8302eb51
commit eb4b9ea440
2 changed files with 12 additions and 7 deletions

View File

@@ -1,4 +1,14 @@
<nz-card nzSize="small" [nzExtra]="refresh" [nzTitle]="cardTitle" [nzLoading]="loading"> <nz-card *ngIf="cardTitle" nzSize="small" [nzExtra]="refresh" [nzTitle]="cardTitle" [nzLoading]="loading">
<ng-container *ngTemplateOutlet="table"></ng-container>
</nz-card>
<ng-container [ngTemplateOutlet]="table" *ngIf="!cardTitle"></ng-container>
<ng-template #refresh>
<i nz-icon nzType="reload" nzTheme="outline" (click)="getData()" title="刷新" style="cursor: pointer"></i>
</ng-template>
<ng-template #table>
<nz-table nzTableLayout="fixed" <nz-table nzTableLayout="fixed"
[nzData]="dataList.list" [nzData]="dataList.list"
[nzTotal]="dataList.total" [nzTotal]="dataList.total"
@@ -57,9 +67,4 @@
</tr> </tr>
</tbody> </tbody>
</nz-table> </nz-table>
</nz-card>
<ng-template #refresh>
<i nz-icon nzType="reload" nzTheme="outline" (click)="getData()" title="刷新" style="cursor: pointer"></i>
</ng-template> </ng-template>

View File

@@ -19,7 +19,7 @@ export class CommonTableComponent<T> implements OnInit, OnChanges {
*/ */
@Input() headData: Data<T>[]; @Input() headData: Data<T>[];
@Input() request: RequestObj; @Input() request: RequestObj;
@Input() cardTitle: string; @Input() cardTitle: string | null;
@Input() template: { @Input() template: {
[fieldValue: string]: { [fieldValue: string]: {
temp: TemplateRef<any>, temp: TemplateRef<any>,