如何在帕格模板中设置图像源? [英] How to set source of the image a variable in a pug template?
本文介绍了如何在帕格模板中设置图像源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在创建电影信息平台时,我想打印图像海报.我无法将图像的来源设置为pug中的变量.
each movie in movies
.col-md-3(style="margin-bottom: 20px;")
.text-center
img(src= "#{movie.Poster}" style="width:100%; height:200px; padding: 0px 40px;")
h5(style="padding: 5px 40px 0px 40px;") #{movie.Title}
h5 #{movie.Year}
解决方案
如果您将图像源存储在movie.Poster
中,那么我认为您应该尝试执行以下操作:
img(src=movie.Poster)
您可以在Pug文档中了解有关属性插值的更多信息. /p>
While creating a movie info platform, I wanted to print image posters. I was unable to set the source of the image to a variable in pug.
each movie in movies
.col-md-3(style="margin-bottom: 20px;")
.text-center
img(src= "#{movie.Poster}" style="width:100%; height:200px; padding: 0px 40px;")
h5(style="padding: 5px 40px 0px 40px;") #{movie.Title}
h5 #{movie.Year}
解决方案
If you have image source stored in movie.Poster
, then I think you should try something like this:
img(src=movie.Poster)
You can read more about attribute interpolation in the Pug documentation.
这篇关于如何在帕格模板中设置图像源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文