当前位置:网站首页>H5页面使用js生成二维码
H5页面使用js生成二维码
2022-07-17 05:05:00 【昔日_少年】
uniapp,vue皆可使用
首先去下载qrcode.js 链接 可以在根目录中新建utils文件夹,把下载的js放进去)
1.引入js 并创建data变量
import qrcode from '@/utils/qrcode.js'
data() {
return {
url: "",
qrcodeURL: ""
}
},
methods: {
//生成url二维满
creatQrCode(){
this.url = window.location.href //获取当前页面链接url
// this.url = 'https://stbzmall.oss-cn-guangzhou.aliyuncs.com/apk/youfenqi.apk? versionId=CAEQDBiBgMD3xI_R2RciIGNiYzQzYmM2NjRiYzQ5MmViMjJkMDU3MmM2MDA3NmM3'
let params = this.url; // 二维码参数
var imgData = qrcode.drawImg(params, {
typeNumber: 4, // 密度
errorCorrectLevel: 'L', // 纠错等级
size: 800, // 白色边框
})
this.qrcodeURL = imgData
},
}
2.页面使用
<view class="qrcode_img" >
<img :src="qrcodeURL" mode="aspectFit"></img>
</view>
<style>
// 二维码
.qrcode_img {
width: 200px;
height: 200px;
display: flex;
justify-content: center;
margin: 0 auto;
img {
width: 800px;
height: 200px;
}
}
</style>
边栏推荐
猜你喜欢

Notes de formation pour la deuxième fois des modèles

Convolutional neural network

Actual cases of data analysis and data mining local house price prediction (716):

Cve-2019-14234 Django jsonfield SQL injection vulnerability

MD5 password encryption

租用服务器,以及部署在pycharm专业版上的pytorch环境训练yolov5模型教程服务器环境安装库文件:

The code of yolov5 model for pest identification in Title A of the 10th Teddy cup data mining challenge (has been run through, original works, continuously updated)

决策树原理和案例应用-泰坦尼克号生存预测

User management - restrictions

数据库实训7【索引与数据完整性约束的创建】
随机推荐
基于cuda10.0的pytorch深度学习环境配置
读论文《SNUNet-CD: A Densely Connected Siamese Network for Change Detection of VHR Images》
es6新增-运算符的扩展
Class object automatic injection attribute operation tool
Infinite classification
读论文《Learning to Measure Changes: Fully Convolutional Siamese Metric Networks for Scene Change Detec》
Three high concurrency methods to realize I++
C语言练习2
6S参数
Pygame:外星人入侵
PAT乙级1002:写出这个数
租用服务器,以及部署在pycharm专业版上的pytorch环境训练yolov5模型教程服务器环境安装库文件:
Notes de formation pour la deuxième fois des modèles
User management - restrictions
基于RTX30显卡的ArcGIS Pro2.8深度学习环境配置
ArcGIS Pro发布服务
NoSQL overview
pygame-飞机大战1.0(步骤+窗口无响应问题)
Use of flask
实习项目1-个性化主页配置