springboot项目中:
ERROR 3884 — [nio-8088-exec-9] org.thymeleaf.TemplateEngine : [THYMELEAF]
在html中使用Thymeleaf和layui表格渲染冲突
cols: [[
{field: 'ID', title: 'ID', width:80, sort: true, fixed: 'left'}
,{field: 'StartTime', title: '日期', width:80}
,{field: 'Abstract', title: '摘要', width:80, sort: true}
]]
这部分要把[[ ]]分开使用,[[ ]]属于Thymeleaf内联元素用法,导致无法进行layui表格渲染。
改成
cols: [
[
{field: 'ID', title: 'ID', width:80, sort: true, fixed: 'left'}
,{field: 'StartTime', title: '日期', width:80}
,{field: 'Abstract', title: '摘要', width:80, sort: true}
]
]
分开使用即可
在Springboot项目中,Thymeleaf模板引擎与layui表格渲染发生冲突,原因在于Thymeleaf的内联元素语法[[]]与layui的JSON格式不兼容。为了解决这个问题,只需将Thymeleaf的内联元素语法改为标准的JSON格式,即将`cols:[[]]`调整为`cols:[]`,确保cols的数组不再包含额外的嵌套,从而正确地渲染layui表格。
761

被折叠的 条评论
为什么被折叠?



