功能描述
通过js接口返回指定字符串内容的二维码图片的base64编码字符串
支持格式
Json
请求参数:
字段 | 可选 | 类型及范围 | 说明 |
---|---|---|---|
desc | 否 | string | 需要被编码成二维码的内容 |
size | 是 | number | 二维码宽度,可指定正方形二维码的大小,默认值都为300 |
请求调用示例params={
"desc":"http://www.hundsun.com",
"size":"600"
}
LightSDK.native.genCode(params,cb);
返回值说明
字段名 | 字段类型 | 说明 |
---|---|---|
result | string | 编码结果:浏览器中返回的是二维码地址,APP中返回的是不含头的base64编码 |
fullUrl | string | 完整的二维码地址(浏览器中返回的是二维码的地址,APP中返回的是包含头的base64编码) |
返回字段示例"data":{"result":"iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAIAAAD2HxkiAAAF0UlEQVR4nO3dQY7jOBAAwfZi///l2cPeOQCFUpLuiOtg7LbshA4qFD9//vz5ATr/1H8A/HYihJgIISZCiIkQYiKEmAghJkKI/bv4t8/n89rfMW09k7D4pEPDDOtru/2myVeWXKK7rC+ROyHERAgxEUJMhBATIcRECDERQkyEEBMhxFYTM2un7cUYGrAYetknV++0+Z6h6Z+1b/r5uRNCTIQQEyHERAgxEUJMhBATIcRECDERQmx/YmbtwEGT91922/bVO3Avy2nzPdvmfiTuhBATIcRECDERQkyEEBMhxEQIMRFCbOph/V1Oe6D8S46v4X/uhBATIcRECDERQkyEEBMhxEQIMRFCTIQQMzEz6MBlE+97f77nOu6EEBMhxEQIMRFCTIQQEyHERAgxEUJMhBCbmpj5mmGIJ+tVvub4mu2dN3/9vxOu++25E0JMhBATIcRECDERQkyEEBMhxEQIsf2H9b9kd8PQc+rkQJi7/tq1b/r5uRNCTIQQEyHERAgxEUJMhBATIcRECDERQuxz3S6Alw0Ni/Bz4R6KIe6EEBMhxEQIMRFCTIQQEyHERAgxEUJMhBCbOhBmYej8kKGXvWuqI9naklyioWmk7UU72y/7404IORFCTIQQEyHERAgxEUJMhBATIcSmHta/fwzIgY+Mh578LgxNLAy96fsP3P9q6LCdNXdCiIkQYi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BMhxEQIMRFCTIQQm3pYf9dz6oUnj4yTHRYLyZfy/kU4cIHFmjshxEQIMRFCTIQQEyHERAgxEUJMhBATIcT2J2ZOGwdJDK1gGHrZbQfuoTjtQJgn3AkhJkKIiRBiIoSYCCEmQoiJEGIihJgIIfY5cIAAfhV3QoiJEGIihJgIISZCiIkQYiKEmAghJkKI/QfOdxtqmV9A+gAAAABJRU5ErkJggg==","fullUrl":""}
注意事项
需要在config.js配置文件中做以下配置:
module.exports = { |
效果