layui表格渲染出错

688 阅读1分钟

错误为:An error happened during template parsing (template: "class path resource [templates/studentSubmitRecord.html]")

我的layui的代码为:

        layui.use('table', function () {
            var table=layui.table;
            table.render({
                elem: '#content1'
                , url:'/StudentController/studentSubmitRecord' //数据接口
                ,async:false
                , cols:[[
                    {field: 'courseName', title: '课程名', width: 200}
                    , {field: 'teacherName', title: '教师名字', width: 200}
                    , {field: 'submitTime', title: '上交时间', width: 200}
                    , {field: 'fileName', title: '上传文件', width: 200}
                    , {fixed: 'right', title: '操作', toolbar: '#BarContent1'}
                ]]
                , page: true
                , layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
                , jump: function (obj, first) {
                    //obj包含了当前分页的所有参数,比如:
                    console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
                    console.log(obj.limit); //得到每页显示的条数
                    //首次不执行
                    if (!first) {
                        //do something
                        var href = '&pageNum=' + obj.curr;
                        href += '&pageSize=' + obj.limit;
                        console.log(href)
                        location.href = href;
                    }

                }
            })
    })

解决方案: 在script标签或者html标签里加入 th:inline="none" 就可以了