zoukankan      html  css  js  c++  java
  • 微信小程序变量加字符串图片显示成功但报 Failed to load local image resource的错

    在开发小程序的时候,发现在加载图片时并没有异常,但是后台却报错了。

    比如:

    <image src="{{domainName + '/%E7%BD%91%E8%AF%BE-icon-%E6%96%B0%E5%BB%BA%E4%B8%93%E8%BE%91.png'}}"></image>

    大概是html模板提前完成,还没识别变量

    Failed to load local image resource xxx the server responded with a status of 500

    那此时的路径{{domainName}}相当于是一个无效的路径,这就对该路径添加wx:if来表示认可。加上下面一句话

    <block wx:if="{{domainName}}">
        <image src="{{domainName + '/%E7%BD%91%E8%AF%BE-icon-%E6%96%B0%E5%BB%BA%E4%B8%93%E8%BE%91.png'}}"></image>
     </block>
  • 相关阅读:
    [solr]
    [solr]
    [Linux] CentOS 加入开机启动
    [Linux] VirtualBox
    [Eclipse]
    [JBoss]
    [solr]
    [solr]
    [solr]
    [solr]
  • 原文地址:https://www.cnblogs.com/hongrun/p/12539316.html
Copyright © 2011-2022 走看看