• mpvue 小程序加载不了图片 Error: Failed to load local image resource /images/xx.png the server responded with a status of 404 (HTTP/1.1 404 Not Found)


    mpvue开发小程序时候,要添加静态本地图片

    <img src="../../images/bg.png" alt="">
    

    会报错:

    VM14878:2 Failed to load local image resource /images/bg.png 
    the server responded with a status of 404 (HTTP/1.1 404 Not Found) 
    

    原因有很多种,解决办法可以改webpack,或mpvue的包,这里提供一个非常直接的办法:

    直接写 /static/img/xx.png
    
    比如:
    <img src="/static/img/bg.png" >
    
    就可以了
    

    原因也很简单,直接存图片放在根目录下的静态资源static文件,自然找到了

  • 相关阅读:
    Mysql基础
    Mysql基础2
    Windows CMD命令大全
    python 调试方法
    LDAP
    Linux 内核与模块调试
    Linux tee命令
    Linux kgdb命令
    OpenSSL基础知识
    Linux top命令
  • 原文地址:https://www.cnblogs.com/liangfengbo/p/9117720.html
Copyright © 2020-2023  润新知