uniapp生成二维码和条形码

uniapp生成二维码和条形码

我们做小程序在我的这个页面经常会遇到有生成二维码的需求,那么我们使用tki-barcode和tki-qrcode这两个组件进行实现我们的需求
组件下载地址:“点击这里
下载之后我们解压到项目的components
接下来第一步:我们就在使用的那个页面进行引用

import tkiBarcode from '@/components/tki-barcode/tki-barcode'
import tkiQrcode from '@/components/tki-qrcode/tki-qrcode'

components: {
	tkiBarcode,
	tkiQrcode
},
<view class="warp_back">
	<u-image src="/static/juxing.png" mode="widthFill" width="90%" height="100%" style="position: relative;margin: 0 auto;"></u-image>
	<view class="component text-center">
		 <view class="component-code">
			<tki-barcode
				ref="barcode"
				onval
				:val="code"
				:load-make="true"
				:opations="barOpations"/>
		 </view>
		<view class="coupon-no-view">{{ code }}</view>
		<view class="component-qr">
			<tki-qrcode
				 ref="qrcode"
				 onval
				 :val="code"
				 :size="250"
				 :load-make="true"
				 :show-loading="false"/>
		</view>
						        
	</view>
		<u-image @click="close" mode="widthFill" class="close" src="/static/close_meck.png" width="60rpx" height="60rpx"></u-image>
	</view>
.warp_back{
			width: 80%;
			height: 58% !important;
			margin: 0 auto;
			position: relative;
			// background-image: url('../../static/juxing.png');
			
			.u-image{
				margin: 0 auto;
				hieght:92% !important;
				
				.u-image__image{
					hieght:92%;
				}
			}
			
			.waro_lfet{
				width: 60rpx;
				height: 120rpx;
				border-top-right-radius: 60rpx;
				border-bottom-right-radius: 60rpx;
				position: absolute;
				top: 10em;
				left: 64rpx;
				background: #F8F8F8;
				
			}
			.close{
				position: absolute;
				bottom: -20%;
				left: 45%;
			}
		}

以上就是一个完整的例子,希望能帮助到你!

  • 0
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

有思想的前端

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值