使用blazorbarcodesscanner . zxing . js产生异常



我尝试从这里为我的Blazor-App使用barcodesscanner组件:

https://www.nuget.org/packages/BlazorBarcodeScanner.ZXing.JS/

当我启动我的应用程序时,我总是得到一些异常。第一个是:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Could not find 'BlazorBarcodeScanner.listVideoInputDevices' ('BlazorBarcodeScanner' was undefined).
Error: Could not find 'BlazorBarcodeScanner.listVideoInputDevices' ('BlazorBarcodeScanner' was undefined).
at https://localhost:44327/_framework/blazor.webassembly.js:1:1287
at Array.forEach (<anonymous>)
at e.findFunction (https://localhost:44327/_framework/blazor.webassembly.js:1:1247)
at b (https://localhost:44327/_framework/blazor.webassembly.js:1:2989)
at https://localhost:44327/_framework/blazor.webassembly.js:1:3935
at new Promise (<anonymous>)
at Object.beginInvokeJSFromDotNet (https://localhost:44327/_framework/blazor.webassembly.js:1:3908)
at Object.w [as invokeJSFromDotNet] (https://localhost:44327/_framework/blazor.webassembly.js:1:64232)
at _mono_wasm_invoke_js_blazor (https://localhost:44327/_framework/dotnet.5.0.7.js:1:190800)
at do_icall (<anonymous>:wasm-function[10596]:0x194e4e)

谁能帮我一下,这个异常的原因是什么?我想我错过了一些设置,但我不知道是哪一个/在哪里。

(假设Blazor Server…)

将以下两行添加到_host.cshtml,就在end-body标签上方:

<script src="_content/BlazorBarcodeScanner.ZXing.JS/zxingjs.index.min.js"></script>
<script src="_content/BlazorBarcodeScanner.ZXing.JS/BlazorBarcodeScanner.js"></script>

按照Blazor条形码扫描器项目的自述文件

中的安装步骤2执行。

最新更新