增加对Enter的判断

This commit is contained in:
mgw
2024-10-24 15:50:32 +08:00
parent 2b83f82989
commit cab9e08066
2 changed files with 3 additions and 3 deletions

View File

@@ -27,7 +27,7 @@ class QRCodeWidget extends Component {
onGlobalKeyDown(event) {
// 如果是Tab键表示扫码输入结束
if (event.key === 'Tab') {
if (event.key === 'Tab' || event.key === 'Enter') {
this.qrCodeValue = this.inputBuffer; // 完整条码赋值
console.log('完整条码:', this.qrCodeValue);
this.onQRCodeChange(this.qrCodeValue); // 调用父组件的 onQRCodeChange 方法