关于图片手机端不显示,电脑端却显示?

小程序 文章 2021-01-29 10:21 402 0 全屏看文

AI助手支持GPT4.0

关于图片手机端不显示,电脑端却显示?Regarding pictures not displayed on the mobile phone, but on the computer?

关于图片手机端不显示,电脑端却显示?
我原本的代码是这样的<view class="bg-img radius-20" style="background-image: url('{{item.src}}');height: 500rpx;" bindtap="btnbox{{item.id}}"></view>这样写,发现只有电脑端微信小程序可以展示出图片;我改成这样后,手机端小程序可以显示图片了,但是这个style没作用。<image class="bg-img radius-20" src="{{item.src}}" bindtap="btnbox{{item.id}}" style="height: 500rpx" mode="widthFix"></image>手机端不支持第一种方法吗???

My original code is like this < view class = "BG img" radius-20 "style =" background image: URL ('/uploads/cj/article/2021/01/29/6bbcf7015b6d96112e05a0bcdf16c6ec.jpg');height: 500rpx;" bindtap="btnbox{{ item.id }}"> < / View > when I write like this, I find that only the wechat app on the computer side can display the pictures; after I change it to this, the app on the mobile side can display the pictures, but this style doesn't work. < / Image > does the mobile terminal not support the first method??? 

回答:

Brother斌🎈:

第一种,背景图片只能用网络链接或者base64,不能用本地图片

第二种,style高度设置没用是因为你写了mode=“widthFix”

Ainjor:是网络地址
威风扫地飞:

图片是本地的吗?背景图一般用网络图片

Ainjor:是网络图片
Ain:

background-size设置了没有,而且有时候要加important

ZZQ:

背景图片需要转成base64

Ainjor:是网络图片,不是本地图片

-EOF-

AI助手支持GPT4.0