将字符串装换成二维码

function handleResult(url, res, data, isDeposit) {
    if (res.code === 0) {
        if ('SCAN_WEIXIN' === data.field.payMethodType || 'SCAN_ALIPAY' === data.field.payMethodType) {
            $("#qrCode").append('<div id="code" style="margin-top: 25px;"></div>');
            jQuery('#code').qrcode({
                render: "table",
                text: res.data.respMap.payInfo
            });
            layer.open({
                title: '请扫描二维码支付',
                type: 1,
                content: $('#code'),
                yes: function () {
                    $('#code').empty();
                    layer.closeAll();
                },
                cancel: function () {
                    $('#code').empty();
                    layer.closeAll();
                }
            });
        }else if ('CODEPAY_W' === data.field.payMethodType) {
            layer.open({
                title: '提示信息',
                content: res.data.respMap.payStatus,
                yes: function () {           
                    layer.closeAll();
                },
                cancel: function () {
                    layer.closeAll();
                }
            });

 通过这个方法即可将二维码串转换成二维码的形式。

原文地址:https://www.cnblogs.com/jourage/p/10444251.html