在springboot项目中使用到layui和Thymeleaf数据表格无法显示问题
解决办法:
在<script></script>标签中加入 th:inline="none"即<script th:inline="none"></script>
例如:
<script th:inline="none">
var layer;
layui.use("layer", function () {
layer = layui.layer;
})
layui.use('table', function(){
var table = layui.table;
table.render({
elem: "#test"
, url: "/bookList"
,toolbar: '#toolbarDemo'
, page: true
, cols: [[
{type: 'checkbox', fixed: 'left'}
, {field: 'id', title: '图书编号', align: 'center', width: 120}
, {field: 'bookName', title: '书名', align: 'center', width: 160}
, {field: 'bookAuthor', title: '作者', align: 'center', width: 280}
, {field: 'publishHouse', title: '出版社', align: 'center', width: 160}
, {field: 'bookType', title: '类型', align: 'center'}
, {field: 'bookStatus', title: '图书状态', align: 'center', templet: '#bookStatus'}
, {fixed: 'right', title: '操作', align: 'center', toolbar: '#barDemo'}
]]
,id: 'testReload'
, limit: 5
, limits: [3, 4, 5, 10, 15]
});
});
</script>