Angular USB条码扫描仪在角度测量中的应用
我在Angular 10中有一个应用程序,我想实现USB条形码扫描仪输入(例如在键盘模式下)。问题是我使用的是packagengx barcodeput,我需要一个输入字段,当条形码扫描时,应该处于活动状态。如何在没有输入字段的情况下使用ngx条形码输出之类的东西?我希望我的扫描仪在页面上始终处于活动状态,而不仅仅是在单击输入字段时。有什么建议吗?我在网上搜索,找不到任何其他包可用于angular应用程序中的usb条形码扫描仪。此代码从angular应用程序中的usb bacode扫描仪扫描条形码 HTML文件:Angular USB条码扫描仪在角度测量中的应用,angular,typescript,barcode,Angular,Typescript,Barcode,我在Angular 10中有一个应用程序,我想实现USB条形码扫描仪输入(例如在键盘模式下)。问题是我使用的是packagengx barcodeput,我需要一个输入字段,当条形码扫描时,应该处于活动状态。如何在没有输入字段的情况下使用ngx条形码输出之类的东西?我希望我的扫描仪在页面上始终处于活动状态,而不仅仅是在单击输入字段时。有什么建议吗?我在网上搜索,找不到任何其他包可用于angular应用程序中的usb条形码扫描仪。此代码从angular应用程序中的usb bacode扫描仪扫描条形
<div class="container">
<header><h1>My App title</h1></header>
<div class="row">
<input type="text" (window:keypress)="onKey($event)" autofocus />
<p>barcode: {{ barcode }}</p>
</div>
</div>
请参见此处的完整代码:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'barcode-scanner',
templateUrl: './scan-barcode.component.html',
styleUrls: ['./scan-barcode.component.css'],
})
export class ScanBarcodeComponent implements OnInit {
barcode: string='';
values: string[] =[];
constructor() { }
ngOnInit(): void {
}
onKey(event: any) {
this.barcode=event.target.value;
}
}