我窩input
標籤的條件:如何防止嵌套輸入標籤時增加表格單元格?
<td *ngFor="let cell of row.Persons">
<span cell.editable === true ">
<input type="number" [(ngModel)]="cell.PersonCount" autofocus />
</span>
<span *ngIf="cell.editable === false " (click)="toggle(cell)">
{{ cell.PersonCount ? cell.PersonCount : '-' }}
</span>
</td>
我試圖設置以下風格,但沒有結果:
<input type="number" [(ngModel)]="cell.PersonCount"
style="display: inline; max-width: 100%; width: inherit; height:
inherit; box-sizing: border-box !important; overflow:hidden;
-moz-box-sizing: border-box !important;
-webkit-box-sizing: border-box !important; border: none;" autofocus />
我的問題是我怎麼能保持細胞的大小是一樣的,就像沒有input
標籤(如第一圖像)?
我創建了an example at plunker,請看看它。
檢查最小寬度。 – lexith
@lexith我應該設置什麼值爲'min-width'? – StepUp
我可能將寬度設置爲100%,最小寬度設置爲0 – lexith