【问题标题】:Using BlazorBarcodeScanner.ZXing.JS produces Exception使用 BlazorBarcodeScanner.ZXing.JS 会产生异常
【发布时间】:2021-08-20 12:14:18
【问题描述】:

我尝试从这里为我的 Blazor-App 使用 BarcodeScanner-Component:

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 zxing blazor-webassembly


【解决方案1】:

(假设 Blazor 服务器...)

将以下两行添加到 end-body 标记上方的 _host.cshtml

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

按照Blazor Barcode Scanner Project's Readme中的安装步骤2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-31
    • 2021-12-31
    相关资源
    最近更新 更多