这就是问题所在,无法检测。我尝试过:
<mat-radio-button [value]="value" (blur)="onBlur($event)">
但徒劳无功。我理解模糊事件应该只有那个些可以聚焦的元素,而里面的材质按钮有输入元素。那么,有没有简单的解决方案而没有复杂的解决方案?提前感谢!
您可以在mat-radio-group
或mat-radio-button
上直接使用事件绑定(focusout)
HTML代码:
<mat-radio-group aria-label="Select an option" (focusout)="outOfFocus()">
<mat-radio-button value="1">Option 1</mat-radio-button>
<mat-radio-button value="2">Option 2</mat-radio-button>
</mat-radio-group>
TS代码:
outOfFocus(){
console.log("You reached out of focus")
}