是否可以为相同的内容类型选择不同的模板(即小枝模板)?
举个例子:3篇博客文章,每个都使用不同的模板显示...?是否在博客帖子创建过程中从下拉列表中选择模板?
发布于 2017-12-15 07:09:20
使用混合
mixin different_blog_view_type(type)
....
if type !== "view1"
.supacoolEl23
.....
if type === "view2"
#moreCoolest2view不要忘记定义locals.type变量,并按照您的喜好更改它(下拉菜单、单选按钮等)
exports = module.exports = function(req, res) {
var view = new keystone.View(req, res);
var locals = res.locals;
locals.type = req.params.type;
//this wil get from :type param
//or you can use req.body or req.queryhttps://stackoverflow.com/questions/47698222
复制相似问题