微信小程序不能使用background-image问题解决
- pages/index/index.wxss 中的本地资源图片无法通过 WXSS 获取,可以使用网络 图片,或者base64,或者使用标签。
/* 片7 代码 */
.sprite_icon {
display: block;
width: 80px;
height: 80px;
/* 此处在wxss中,可以使用网络图片,不能使用本地图片 */
background: url("https://cdn.nlark.com/yuque/0/2020/png/1252071/1589205723989-7de580b9-c9fd-4485-8b5b-3768f2f31bd0.png") -180px -310px;
}
附录 一键转话 base64格式
https://www.sojson.com/image2base64.html