// 生成小程序码
export function createpublicwxaqrcode(query) {
let params={width:300,appid:'wxaxxa',type:2,...query}
return http.request({
url: '/system/wx/wxaapp/createpublicwxaqrcode',//换成自己的接口
responseType: 'arraybuffer',
method: 'get',
params
})
}
使用方法
createpublicwxaqrcode(param).then((data)=>{
const arrayBuffer = new Uint8Array(data)
const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(arrayBuffer) //这里需要添加前缀
this.wxImg = base64 || '';
})