关于Failed to load local image resource xxxxxx.png the server responded with a status of 404的问题

    xiaoxiao2023-11-25  113

    首先我开发中遇到的问题:图片加载出来了,但是在微信开发工具中报这个错误:

    Failed to load local image resource /xxx/xxx/.png the server responded with a status of 404

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

    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

    由于我的照片是在本地的,所以没有后面的:

    From server 127.0.0.1

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

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

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

    <image class="tip-image" wx:if='{{nowInfo.now.code}}' bindtap='refreshPage' src="../../image/weather/{{nowInfo.now.code}}.png"></image>

    希望对大家有帮助。

    如果觉得有解决你的问题的话点个赞再走吧!

    最新回复(0)