uniapp使用qrious.js插件生成二维码

uniapp使用qrious.js插件生成二维码

github网址 https://github.com/neocotic/qrious

在项目控制台执行命令安装插件 npm install qrious --save

二维码生成方法

<template>
	<view class="main">
		<view class="title title-img">
			<text style="border-bottom: 10rpx solid #203c42;">点击生成二维码</text>
			<image mode="aspectFill"src="../../static/images/erweima.png" @click="openQrCodeImg()"></image>
		</view>
		
		
		<image :show="invoiceInformShow" mode="aspectFit" :src="qrCodeImg"></image>
			
	</view>


</template>

<script>
	import Qrcode from 'qrious';
	export default {
		data() {

			return {
				invoiceInformShow: false,//是否打开二维码
				qrCodeImg: "",
			}
		},
		methods: {
			
			//获取二维码核心代码
			openQrCodeImg() {
				var that = this
				let qr = new Qrcode({
					size:220 ,// 尺寸大小
					mime:'image/png', // 图片类型
					value: "https://www.baidu.com",//码的内容
				});
				this.qrCodeImg = qr.toDataURL();
				this.invoiceInformShow = true
				
			},
		},
		onLoad(options) {
			
		}
	}
</script>

<style>
	
	.main {
		padding:10rpx 20rpx 20rpx 20rpx;
		background: white;
		margin: 20rpx;
		border-radius: 10rpx;
	}
	.main  .title-img{
		position: relative;
	}
	.main  .title-img image{
		position: absolute;
		right: 10rpx;
		top: 2rpx;
		width: 80rpx;
		height: 80rpx;
		border-radius: 10rpx;
	}
	
	
	.main  .title{
		font-size: 35rpx;
		border-bottom: 1rpx solid #e1e1e1;
		font-weight: bold;
		padding: 20rpx 0rpx 30rpx 0rpx;
	}
	
	
</style>

其他参数
在这里插入图片描述

效果图

在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值