没有合适的资源?快使用搜索试试~ 我知道了~
Vue实现手机扫描二维码预览页面效果
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
![star](https://csdnimg.cn/release/downloadcmsfe/public/img/star.98a08eaa.png)
温馨提示
本文实例为大家分享了Vue实现手机扫描二维码预览页面的具体代码,供大家参考,具体内容如下 背景:vue-cli3 + ant-design-vue 搭建的后台管理系统 需求:实现扫描二维码即可在手机预览H5页面功能 使用插件:qrcode step1:安装插件 npm install qrcode --save step2:引入插件 在项目中新建QRcode.vue文件 <template> <div id=qrCode> <div id=code></div> <canvas id=canvas></canvas> </div> </template> <script
资源详情
资源评论
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/13968809/bg1.jpg)
Vue实现手机扫描二维码预览页面效果实现手机扫描二维码预览页面效果
本文实例为大家分享了Vue实现手机扫描二维码预览页面的具体代码,供大家参考,具体内容如下
背景:背景:vue-cli3 + ant-design-vue 搭建的后台管理系统
需求:需求:实现扫描二维码即可在手机预览H5页面功能
使用插件:使用插件:qrcode
step1::安装插件
npm install qrcode --save
step2::引入插件
在项目中新建QRcode.vue文件
<template>
<div id="qrCode">
<div id="code"></div>
<canvas id="canvas"></canvas>
</div>
</template>
<script>
import QRCode from "qrcode";
export default {
props: {
url: {
type: String
}
},
data() {
return {
msg: "hello vue",
codes: ""
};
},
components: {
QRCode: QRCode
},
methods: {
useqrcode() {
var canvas = document.getElementById("canvas");
QRCode.toCanvas(canvas, this.url, function(error) {
if (error) console.error(error);
});
}
},
mounted() {
this.useqrcode();
}
};
</script>
<style lang="stylus" scoped>
#qrCode {
text-align: center;
}
</style>
step3::在需要使用该插件的地方引入
例如:
<template>
<div>
<QRcode :url='url'/>
</div>
</template>
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![jar](https://img-home.csdnimg.cn/images/20210720083455.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![thumb](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
weixin_38691256
- 粉丝: 3
- 资源: 945
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
评论2