qrcode生成二维码
html
<div id="qrcode" class="qrcode"></div>
js
  let _url = "https://test1561.chot.cn/web/?page=positionDetail&id="+_item.id+"&total="+ _this.pageList.total;
            /* 生成二维码 */
            setTimeout(()=>{
                $("#qrcode").qrcode({
                    text: _url, //设置二维码内容
                    render: "table", //设置渲染方式
                    width:200, //设置宽度,默认生成的二维码大小是 256×256
                    height: 200, //设置高度
                    typeNumber: -1, //计算模式
                    background: "#ffffff", //背景颜色
                    foreground: "#000000" //前景颜色
                });
                let _child = $("#qrcode").children();
                if(_child.length>1){
                    $("#qrcode").children().eq(0).remove(); // 删除已有的,否则二维码会叠加
                }
            },200);
注意:必须使用延时,否则首次无法生成二维码
本文来自博客园,作者:小虾米吖~,转载请注明原文链接:https://www.cnblogs.com/LindaBlog/p/16520326.html
 
                    
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号