我正在使用由角形材料制成的垫菜单组件。但是,该内容不适合菜单。 我不想使用mat-select,因为我想显示一个按钮,其值不同于下拉菜单中的值。
现在我的问题是,如何在菜单中显示全文?有任何种类的多行或工具提示吗?
<button mat-button [matMenuTriggerFor]="menu">{{row.menuShortText}}</button>
<mat-menu #menu="matMenu">
<span mat-menu-item>This is a very long text that does not fit</span>
<span mat-menu-item>this fits</span>
<span mat-menu-item>this fits</span>
<span mat-menu-item>this fits</span>
<span mat-menu-item>this fits</span>
</mat-menu>
答案 0 :(得分:0)
如果提示正确,您可以将其添加到范围:
<button mat-button [matMenuTriggerFor]="menu">menu</button>
<mat-menu #menu="matMenu">
<span mat-menu-item matTooltip="This is a very long text that does not fit">
This is a very long text that does not fit</span>
<span mat-menu-item>this fits</span>
...
</mat-menu>
别忘了导入MatTooltipModule