当前位置:网站首页>uni-app使用canvas绘制二维码
uni-app使用canvas绘制二维码
2022-06-26 18:49:00 【gblfy】

1. 插件选型
uqrCode
2. 页面部分
template:
<view class="canvas-qrcode-box" style="align-self: center;">
<canvas id="qrcode" canvas-id="qrcode" style="width: 170px;height: 170px;align-self: center;" />
</view>
3.事件部分
<script>
var system = uni.getSystemInfoSync();
import uQRCode from '@/uni_modules/Sansnn-uQRCode/components/uqrcode/common/uqrcode.js'
export default {
data() {
return {
vlogId: "",
// screenHeight: system.screenHeight,
screenHeight: system.safeArea.bottom,
statusBarHeight: system.statusBarHeight
}
},
onReady() {
var vlogId = this.vlogId;
var content = {
type: "vlog",
content: vlogId
};
var contentStr = JSON.stringify(content);
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
size: 170,
margin: 10,
text: contentStr,
backgroundColor: '#ffffff',
foregroundColor: '#0f0827',
fileType: 'png',
errorCorrectLevel: uQRCode.errorCorrectLevel.H
})
.then(res => {
})
},
onLoad(params) {
var vlogId = params.vlogId;
this.vlogId = vlogId;
},
methods: {
close() {
uni.navigateBack({
delta: 1,
animationType: "slide-out-bottom"
})
},
}
}
</script>
边栏推荐
- PC端录制扫515地机器人/scan数据
- ROS query topic specific content common instructions
- Project practice 6: distributed transaction Seata
- 成功解决之idea引用Lombok的@Slf4j后无法正常使用log
- stm32和电机开发(直流有刷电机和步进电机)
- ROS的发布消息Publishers和订阅消息Subscribers
- sql 中的alter操作总结
- Pinda general permission system (day 3~day 4)
- sqlite数据库的系统表sqlite_master
- 微信小程序 自定义 弹框组件
猜你喜欢
随机推荐
Development principle analysis and source code of dapp-lp single and dual currency liquidity pledge mining system
Convex hull problem
Summary of alter operation in SQL
Handwritten numeral recognition based on tensorflow
Pinda general permission system (day 3~day 4)
To: Apple CEO Cook: great ideas come from constantly rejecting the status quo
Comparing the size relationship between two objects turns out to be so fancy
LeetCode 128最长连续序列
sqlite数据库的系统表sqlite_master
sql 中的alter操作总结
预编译处理指令中的条件编译
Request method 'POST' not supported
DAPP丨LP单双币流动性质押挖矿系统开发原理分析及源码
(树) 树状数组
JSONUtils工具类(基于alibaba fastjson)
Soft test preparation multimedia system
Solidity - contract inheritance sub contract contains constructor errors and one contract calls the view function of another contract to charge gas fees
Preliminary analysis of serial port printing and stack for arm bare board debugging
读书笔记:《过程咨询 III》
Take you to resolve hash conflicts and implement a simple hash table,










