1 Star 2 Fork 0

tingShe / js_common_tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
qrcode.md 1.82 KB
一键复制 编辑 原始数据 按行查看 历史
zhangbo 提交于 2024-02-26 15:38 . # Conflicts:

函数说明

* 表示参数必填

createQRCode 绘制二维码

[系统支持:微信小程序、WEB]

function createQRCode(obj)

obj 参数说明

  • @param { String } text 生成的内容文本,只支持0-127的ASCII码,字母、数字、数字符号,字符串长度最大2953 *

  • @param { String } background 生成的二维码图背景色 (默认:rgba(0,0,0,0))

  • @param { String } color 生成的二维码图数据码颜色 (默认:rgba(0,0,0,255))

  • @param { Number } size 生成的二维码图尺寸大小 (默认:300)

  • @param { String } image 绘制到二维码图中的图片

  • @param { Number } imageProportion 图片在二维码图中的尺寸占比 (默认:0.2)

  • @param { Array } imageBorderRadius 图片在二维码图中的圆角,是一个大小为4的数值数组,对应圆角位置;[0]-左上,[1]-右上,[2]-右下,[3]-左下 (默认:[20, 20, 20, 20])

  • @returns { PosterImage } 返回二维码图信息,详见海报绘制参数文档说明

示例:

    const res = await createQRCode({
        color: "rgba(255,0,0,255)",
        text: "https://fanyi.baidu.com/translate?aldtype=16047&query=%E4%BA%8C%E7%BB%B4%E7%A0%81%0D%0A&keyfrom=baidu&smartresult=dict&lang=auto2zh&ext_channel=Aldtype#zh/en/%E4%BA%8C%E7%BB%B4%E7%A0%81",
        image: "https://filewallet.metacellar.art/20240130/metacellar/8be6c75b32/apilogo_20240130110452A002.png"
    })
    console.log(res)
JavaScript
1
https://gitee.com/ting-she/js_common_tools.git
git@gitee.com:ting-she/js_common_tools.git
ting-she
js_common_tools
js_common_tools
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891