CRONWMMM/multi_page_app_template

关于ejs中图片地址引用变量无法编译的问题

Opened this issue · 0 comments

  • 1、ejs这样写:
    <img class="img-responsive" src=“../static/imgs/hardware/<%%=main_data.short[i].img%>” alt="...">
    ejs不识别并报错

  • 2、ejs这样写:
    <img class="img-responsive" src="${require(../static/imgs/hardware/main_data.short[i].img)}" alt="...">
    ejs也不识别,输出
    <img class="img-responsive" src="${require(../static/imgs/hardware/main_data.short[i].img)}" alt="...">

  • 3、ejs这样写:
    <img class="img-responsive" src="<%%=main_data.short[i].img%>" alt="...">
    ejs能识别,但是webpack不能编译,输出
    <img class="img-responsive" src="image001.png" alt="...">,而正常的src应该是name.hash5.格式