如何将 EJS 变量传递给 LightGallery 的数据源



我想在nodeJS中使用LightGallery设计Image Gallery。当我静态传递图像名称(路径(时,它工作正常,但现在我想传递 EJS 变量,该变量将包含文件夹中所有图像的名称,但它不起作用

这是代码

<% images.forEach(function(image){ %>
<% var imgpath = '/'+ new String(image) %> 
<div class=" col-sm-6 col-lg-4">
<div  zoom="false" data-download-url="false" data-sub-html="<h4>Fading Light</h4><p>Classic view </p>" data-src= <%= imgpath %> > //not Working Here tried Adding quotes still...
<a href=""> 
<img class="img-thumbnail img-responsive" src= "<%= imgpath %>" > 
//This works fine here
</a>
</div>
</div>
<% }) %>

得到了答案!这是一个引导错误,我使用了" 这就是问题所在!

最新更新