在 <mat-error> 元素中添加 role="alert" 属性。
代码示例:
<!-- 加入 role="alert" 属性 --> <mat-error role="alert">用户名不能为空</mat-error>