thymeleaf+layui加载页面渲染时,TemplateProcessingException: Could not parse as expression: "

错误截图:

在这里插入图片描述

错误代码:

 table.render({
            elem: '#demo'
            ,height: 312
            ,url: '/list' //数据接口
            ,page: true //开启分页
            ,cols: [[ //表头
                {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
                ,{field: 'username', title: '用户名', width:80}
                ,{field: 'password', title: '密码', width:80, sort: true}
                ,{field: 'email', title: '邮箱', width:80}
                ,{field: 'status', title: '状态', width: 177}
                ,{field: 'code', title: 'uuid', width: 80, sort: true}
            ]]
        });

    });

错误原因:

因为[[…]]之间的表达式在thymeleaf被认为是内联表达式,所以渲染错误

解决方法:

把cols后的[[ ]]变为

[

[

]

]

正确代码:

 table.render({
            elem: '#demo'
            ,height: 312
            ,url: '/list' //数据接口
            ,page: true //开启分页
            ,cols: [
            [ //表头
                {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
                ,{field: 'username', title: '用户名', width:80}
                ,{field: 'password', title: '密码', width:80, sort: true}
                ,{field: 'email', title: '邮箱', width:80}
                ,{field: 'status', title: '状态', width: 177}
                ,{field: 'code', title: 'uuid', width: 80, sort: true}
            ]
            ]
        });

    });
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值