我正在尝试从此对象动态加载内容
projects = {
test1:{
'name': 'Test',
'description': 'This is just a test description for a test project.',
'img': {
'thumbnail': '/img/260x180.png',
'screenshot': '/img/1024x500.png'
},
'link': '/projects/test1'
},
test2:{
'name': 'Test2',
'description': 'This is just a test description for a test project.',
'img': {
'thumbnail': '/img/260x180.png',
'screenshot': '/img/1024x500.png'
},
'link': '/projects/test2'
}
};
如下
var id = req.params.id;
res.send('index/project',{title: title, project: projects.id});
它以未定义的形式返回。我也尝试过使用 JSON.stringify() 但这也不起作用。有任何想法吗?