qrcode1 = new QRCode('canvas', {
text: app.globalData.mobile,
width:100,
height:100,
colorDark: "#1CA4FC",
colorLight: "white",
correctLevel: QRCode.CorrectLevel.H,
});
<view class="container">
<block >
<View class="QRbackground">
<image src="tttt.jpg"></image>
</View>
<view class="userinfo-avatar" >
<open-data type="userAvatarUrl"></open-data>
</view>
<canvas class='canvas' canvas-id='canvas' bindlongtap='save'></canvas>
</block>
.cavas{
position: fixed;
top:-400rpx;
width :100rpx;
height: 100rpx;
}
.QRbackground image{
position: fixed;
top:300rpx;
left:75rpx;
right:75rpx;
width:600rpx;
height:600rpx ;
}我想实现这种布局效果,就是二维码要显示在一个白色图片的中央,具体代码已贴,为什么二维码的布局位置总是没效果
canvas 的定位决定了位置,只要设好它的居中位置(margin: 0 10%)
是的,我想把二维码放到那张白色底图的中央,放不进去
canvas不是用了定位,是定位没有效果嘛
<block wx:if="{{showQR}}" >
<View class="QRbackground">
<image src="rrrrr.png"></image>
</View>
<view class="userinfo-avatar" >
<open-data type="userAvatarUrl"></open-data>
</view>
<canvas class='canvas' canvas-id='canvas' bindlongtap='save'></canvas>
</block>
.QRbackground image{
margin-top:300rpx;
margin-left:75rpx;
margin-right:75rpx;
width:600rpx;
height:600rpx ;
}
.userinfo-avatar{
margin-top:-1125rpx;
margin-left:225rpx;
margin-right:225rpx;
width:150rpx;
height: 150rpx;
overflow: hidden;
border-radius: 50%;
}
cavas{
margin-top:150px;
width :250px;
height: 250px;
}
text: app.globalData.mobile,
width:150,
height:150,
colorDark: "#1CA4FC",
colorLight: "white",
correctLevel: QRCode.CorrectLevel.H,
});
vanvas的宽高只能在js里面配置吗,在wxss里面不能配置吗