账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    import 引入图片后的路径问题
    27
    0

    在 js 中通过使用 import 引入图片,如果图片不被转成 base64,会在打包过程中将图片转移至 dist/static 目录下。

    import titleImg from './images/title.png';
    
    export default class Login extends Component {
        render() {
            return (<img src={titleImg} alt="标题" />)
        }
    }

    但是此时的图片路径不应该是 /static/title.ce51fdaf.png,而应该是 ./static/title.ce51fdaf.png

    网站路径是
    |——index.html
    |——static
    |——|
    |——|——title.ce51fdaf.png

    这应该是在打包配置中可以修改的吧?

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 魔幻四少 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部