1.微信小程序与html标签的异同
2. 在wxss中直接设置元素的背景图片报错不显示
技术栈:mpvue + vant Weapp
在微信小程序的开发中,在wxss中给元素设置图片有两种方式
1⃣️ 在行内设置 image标签设置src属性
<view class="modelIndex modelTask">
<image class="modelImg" src="/static/images/modelTask.png"></image>
</view>
.modelIndex {
position: relative;
float: left;
width: 50%;
height: 50%;
}
.modelIndex .modelImg {
position: absolute;
width: 100%;
height: 100%;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-size: 100% 100%;
z-index: 11;
}
2⃣️ 将图片转换为base64位可识别