【小程序与公众号】Failed to load local image resource ... the server responded with a status of 500

开发中遇到的问题:图片加载出来了,但是在微信开发工具中报这个错误:
在这里插入图片描述

在我查阅问题的时候看到大家出现的问题大多是这样描述的:

Failed to load image xxx the server responded with a status of 404 (HTTP/1.1 404 Not Found) 
From server 127.0.0.1

但是问题是一个性质,在微信开发工具中主要是因为:

初始化的时候,变量还没渲染进去

所以在这个时候你就需要在src前面加个 wx:if 去渲染。具体事例:

<image 
class="tip-image" 
wx:if='{{nowInfo.now.code}}' 
bindtap='refreshPage' 
src="../../image/wxfox/{{shareImage}}.png"
>
</image> 
发布了134 篇原创文章 · 获赞 80 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/Umbrella_Um/article/details/103319664