有没有办法将视图呈现给变量?我想改变这一点。
var events = {
lastIndex: 32,
payload = [
{
id: 5,
title: "Hello world!"
conyent: "Lorem ipsum"
},
{
id: 7,
title: "Hello world!"
conyent: "Lorem ipsum"
},
...
{
id: 32,
title: "Hello world!"
conyent: "Lorem ipsum"
}
]
};
return reply.view('event/list', {
events: events.payload
});
对此:
return {
events.lastIndex: 32,
view: toView('event/list',events.payload)
}
我使用 Hapi v8 和 Jade 作为渲染引擎。