generateQRCode

生成二维码

import { MBarcode } from "@yl/super-jssdk"

MBarcode.generateQRCode(optional)

参数说明

参数 类型 必填 作用
optional Object 必填参数

optional

参数 类型 必填 作用
content string 需要生成的内容
generatePath String 成二维码后保存的文件地址
options object 自定义参数

options参数说明

参数 类型 作用
width number 生成图片宽.默认值是120
height number 生成图片高.默认值是120
logoPath String 二维码logo小图标地址.会在二维码中间加上logo. 支持本地或网络路径

返回说明

参数 类型 作用
resolve(result) Function 成功回调,result是二维码图片地址
reject(err) Function 失败回调,err为详细错误信息,是一个json对象,例如:{"errCode":-1,"errMsg":"出错啦"}

代码示例

MBarcode.generateQRCode({
   content: '111',
   generatePath: cordova.file.cacheDirectory + "test.jpg"
})
  .then((res) => {
    console.log(res);
  })
  .catch(err => {
    console.log('插件调用失败:', err)
  })

results matching ""

    No results matching ""