uniapp自定义扫码界面

328 阅读1分钟

页面很简单这是一个nvue页面

<view>
        <barcode id='1' class="barcode" autostart="true" ref="barcode" background="rgb(0,0,0)" frameColor="#1C86EE" scanbarColor="#1C86EE" :filters="fil" @marked="success1" @error="fail1"></barcode>
        <text class="btn" @click="gob">手动添加打印</text>
</view>

然后样式

 .barcode {
	width: 750rpx;
	height: 1400rpx;
	background-color: #808080;
}

.btn {
	position: fixed;
	bottom: 300rpx;
	border: 1rpx solid #fff;
	width: 300rpx;
	height: 80rpx;
	font-size: 40rpx;
	margin-left: 225rpx;
	margin-top: 10rpx;
	color: #fff;
	line-height: 80rpx;
	text-align: center;
}
    

加一个点击事件

 success1(e) {
    console.log(e)
}