扫描后移除二维码

Remove QR Code after being Scanned

我尝试阅读文档或在 Whosebug 或在线搜索其他类似问题,但要么我没有使用谷歌搜索 correctly.I我不确定如何删除 QRCode已扫描。

标签中显示有误吗?

QR 码是从不是从数据库中获取的类型字符串生成的。

我是否需要一个数据库和一个脚本 运行 间隔来检查二维码是否已被读取, 我是不是猜错了?

//in my file.ts
createCode() {
this.createdCode = this.qrData;
}

我的显示扫描二维码的代码

//in my file.html
<ion-card *ngIf="createdCode">
  <ngx-qrcode [qrc-value]="createdCode"></ngx-qrcode>
    <ion-card-content>
      <p>Value: {{ createdCode}}</p>
  </ion-card-content>
</ion-card>

如果您遇到任何相关问题,请向我咨询,因为我无法在几个小时的低谷中找到确切的位置。

提前致谢!

没关系,我只需要添加 span class 来处理关闭它。

<span class = 
            "closebtn" onclick="this.parentElement.style.display='none';">&times;
       </span> 
         <ion-card *ngIf="createdCode">
           <ngx-qrcode [qrc-value]="createdCode"></ngx-qrcode>
                <ion-card-content>
                    <p>Value: {{ createdCode}}</p>
                </ion-card-content>
            </ion-card>

并在 file.scss 中添加以下内容以显示关闭按钮。

    .closebtn {
    margin-left: 15px;
    color: white;
    font-weight: bold;
    float: right;
    font-size: 22px;
    line-height: 20px;
    cursor: pointer;
    transition: 0.3s;
    color: black;
}