uniapp中制作可拖拽浮动二维码显示在播放视频上

使用到插件:u-qrcode(生成二维码):

官方文档:uQRCode 中文文档

uniapp 文档:uQRCode 全端二维码生成插件 支持nvue 支持nodejs服务端 - DCloud 插件市场

效果图:

 实现代码:

HTML:

<video :src="videoSrc" class="VEDIOS" show-fullscreen-btn=false>
			<movable-area class="movable-area">
				<movable-view class="movable-view" :x="x" :y="y" direction="all"  @change="onChange" damping=20 friction=2 inertia=true >
					<cover-view class="coverView">
						<cover-image class="coverImage" :src="imgSrc"></cover-image>
					</cover-view>
				</movable-view>
			</movable-area>
		</video>
		
		<u-qrcode
		ref="qrcode"
		class="uqrcode"
		canvas-id="qr" 
		:value="qrobj" 
		:size="size"
		:options="{
		backgroundImageAlpha:0.3,
		foregroundColor:'#000',
		foregroundImageWidth:40,
		foregroundImageHeight:40, 
		errorCorrectLevel:2,
		foregroundImageSrc:'/static/img/logo@3x.png'}" 
		@complete="qrComplete($event)"></u-qrcode>

javascript: 

onChange(e){//防伪图移动位置改变事件
				console.log(e);
				this.x=e.detail.x;
				this.y=e.detail.y;
			},
			qrComplete(e) {//二维码生成
				if (e.success) {
					console.log('生成成功');
					this.$refs.qrcode.save({
					  success: (res) => {
					    // uni.showToast({
					    //   icon: 'success',
					    //   title: '保存成功'
					    // });
						console.log("本地的图片地址=>",res);
						this.imgSrc = res.path;
					  }
					});
					this.$refs.qrcode.toTempFilePath({
					  success: res => {
					    console.log("临时的图片地址=>",res);
						// this.imgSrc = res;
					  }
					});
				} else {
					console.log('生成失败');
				}
			}
  • 6
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值