我有一张表格,有些单元格溢出了。这些单元<td>
格有一个类,在末尾有一个省略号。但是有没有办法在省略号后面添加一个小按钮/跨度/其他东西?
<td #elCol ...>
<ng-container *ngIf="overflows(elCol)">
YES <!-- this is displayed when it overflows, the function works -->
</ng-container>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
<button *ngIf="overflows(elCol)">
click me <!-- Can't get this to displayed because it is behind the text -->
</button>
</td>
td {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 20rem;
}
可以采用 HTML/SCSS 和 TS/JS 解决方案