在Grails 3中,设置layout:null似乎不会覆盖可能存在的默认布局。在Grails 2.5.4中不是这种情况。覆盖布局的操作/优先顺序似乎已更改。也许我通过尝试设置渲染 View :“myView.gsp”,layout:null来避免设置布局而使用了未公开的功能?
render view: "/account/profile/viewProfile",
layout: springSecurityService.isAjax(request) ? null : "customLayout"
最佳答案
从Grails 3(确认为3.2.6版)开始,如果您的布局与您的 Controller 名称匹配(即AccountController和layouts.gsp),则必须将布局更改为其他布局,以控制布局是否为通过layout:null机制在渲染 View 时应用。
关于grails - 在Grails 3(已确认3.2.6)中,具有空布局的渲染 View 无法正确覆盖默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42217743/