我是Web开发的新手,正在尝试学习如何使用javascript和.pug。我已使用图像文件设置了var camgrounds
router.get('/campgrounds', function (req, res) {
var campgrounds = [
{
title: "Paynetwon Campground",
image: img(src ="https://cdn.pixabay.com/photo/2020/06/14/17/57/mountains-5298769_960_720.jpg")
}];
res.render('campground', {
campgrounds: campgrounds
});
});
当我尝试进入露营地渲染页面时,出现错误消息“未定义img”
在我的camground.pug上,我这样写道:
doctype html
each camping in campgrounds
ul
li= camping.title
li = camping.image
有人可以帮助您解决此错误代码吗?
找到了..这只是img(src = camp.image)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句