zoukankan      html  css  js  c++  java
  • 支付宝小程序中将信息生成二维码

    在小程序页面生成二维码,先看下目录结构,除了四个必备文件之外,引入了三个文件

    一个是条形码,一个是二维码

    在.js文件中引入配置

    function barc(id, code, width, height){
        barcode.code128(my.createCanvasContext(id), code, convert_length(width), convert_length(height))
    }
    
    function qrc(id, code, width, height) {
        qrcode.api.draw(code, {
            ctx: my.createCanvasContext(id),
             convert_length(width),
            height: convert_length(height)
        })
    }
    function convert_length(length) {
        return Math.round(my.getSystemInfoSync().windowWidth * length / 750);
    }
    var wxbarcode = require('./index.js');

    code中是二维码的信息,自己根据需要去修改

    在axml中展示,如果code中信息改变要重新调用onShow函数

    编程五分钟,调试两小时...
  • 相关阅读:
    文档测试
    浅谈兼容性测试
    配置测试
    测试产品说明书
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
  • 原文地址:https://www.cnblogs.com/kingjordan/p/12027005.html
Copyright © 2011-2022 走看看