gpt4 book ai didi

angular - 在无法识别的 ionic 5 错误元素中显示二维码 ngx-qrcode

转载 作者:行者123 更新时间:2023-12-05 05:00:41 25 4
gpt4 key购买 nike

我正在尝试生成二维码并在 ionic 组件中显示它。我尝试了以下库 https://www.npmjs.com/package/ngx-qrcode2

但它似乎没有正确识别元​​素。我试过:

<ngx-qrcode 
[qrc-value] = "value"
</ngx-qrcode>

error

还有:

  <ngx-qrcode 
[elementType]="elementType"
[value] = "value"
cssClass = "aclass"
errorCorrectionLevel = "L">

运行时出现以下错误:

ERROR Error: Uncaught (in promise): Error: Template parse errors:Can't bind to 'value' since it isn't a known property of 'ngx-qrcode'.

  1. If 'ngx-qrcode' is an Angular component and it has 'value' input, then verify that it is part of this module.
  2. If 'ngx-qrcode' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this componentto suppress this message.
  3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" <ngx-qrcode [ERROR ->][value]="value">

我知道这个库现在已经被弃用了,所以我试过了 https://www.npmjs.com/package/@techiediaries/ngx-qrcode

类似的结果:

enter image description here

enter image description here

库在组件模块中导入如下:

import { UbicacionPageRoutingModule } from './ubicacion-routing.module';

import { UbicacionPage } from './ubicacion.page';
import { UbicacionAltaComponent } from './ubicacion-alta/ubicacion-alta.component';
import { NgxQRCodeModule } from '@techiediaries/ngx-qrcode';
import { VerQrUbicacionModalComponent } from './ver-qr-ubicacion-modal/ver-qr-ubicacion-modal.component';

@NgModule({
entryComponents: [UbicacionAltaComponent, VerQrUbicacionModalComponent],
imports: [
CommonModule,
FormsModule,
IonicModule,
UbicacionPageRoutingModule,
NgxQRCodeModule
],
declarations: [UbicacionPage, VerQrUbicacionModalComponent],
exports: [ UbicacionAltaComponent, VerQrUbicacionModalComponent]
})
export class UbicacionPageModule {}

最佳答案

  1. 使用 ngx-qrcode 而不是 ngx-qrcode2(已弃用)
  2. 确保您已导入App Module 和您的Component Module

关于angular - 在无法识别的 ionic 5 错误元素中显示二维码 ngx-qrcode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63018176/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com