【发布时间】:2019-12-21 14:09:28
【问题描述】:
我尝试了官方文档,但这不起作用。
https://github.com/strapi/strapi-docs/blob/master/files/views.md
【问题讨论】:
我尝试了官方文档,但这不起作用。
https://github.com/strapi/strapi-docs/blob/master/files/views.md
【问题讨论】:
这里是如何在 Strapi 中使用 EJS 的指南
...
{
"ejs": {
"enabled": true,
"layout": false,
"viewExt": "ejs",
"partial": true,
"cache": false,
"debug": true
}
}
...
module.exports = {
//GET /index
index: async (ctx) => {
ctx.render('home', {title: 'Hello world'});
}
};
<%= title %>
旁注:在上面的示例中,我在控制器 api-name.js 文件中使用了“索引”。确保您的 API ./api/api-name/config/routes.json 指向它。