您能请我解释一下let-columns和let-columns =“ columns”之间的区别吗?在这两种情况下,模板都知道FOR的列
<p-table [columns]="cols" [value]="cars" (sortFunction)="customSort($event)" [customSort]="true">
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns" [pSortableColumn]="col.field">
{{col.header}}
<p-sortIcon [field]="col.field"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr>
<td *ngFor="let col of columns">
{{rowData[col.field]}}
</td>
</tr>
</ng-template>
</p-table>