如何设置切换组中默认选择的最后一个按钮。
这是我的代码。
<mat-button-toggle-group #group="matButtonToggleGroup">
<mat-button-toggle value="Heritage">
<span>Heritage</span>
</mat-button-toggle>
<mat-button-toggle value="Nature">
<span>Nature</span>
</mat-button-toggle>
<mat-button-toggle value="People">
<span>People</span>
</mat-button-toggle>
<mat-button-toggle value="All">
<span>All</span>
</mat-button-toggle>
</mat-button-toggle-group>
我修好了它。只需将value
属性添加到mat-button-toggle-group
标签即可。
<mat-button-toggle-group #group="matButtonToggleGroup" value="All">
<mat-button-toggle value="Heritage">
<span>Heritage</span>
</mat-button-toggle>
<mat-button-toggle value="Nature">
<span>Nature</span>
</mat-button-toggle>
<mat-button-toggle value="People">
<span>People</span>
</mat-button-toggle>
<mat-button-toggle value="All">
<span>All</span>
</mat-button-toggle>
我投票赞成,但您也可能在github上看到