vue手机二维码生成

64 阅读1分钟

// 获取APP最新版本号和地址
export function AppVersionApi(data) {
   return request({
      url: '.....',
      method: 'POST',
      data: .....
   })
}

created() {
   this.handleApp();
},
核心就是一下方法。
/**
 * 下载移动端
 */
handleApp() {
   this.$nextTick(async () => {
      const res = await AppVersionApi();
      const codeHtml = document.getElementById("app_qrcode");
      codeHtml.innerHTML = "";
        //text就是url+文件地址,https://www..../project/text/1.apk
      let qrcode = new QRCode('app_qrcode', {
         width: 200,
         height: 200,
         text: res.data.domain + res.data.file_url, // 二维码地址
      })
   })
}