Thymeleaf使用easy-ui出现脚本无法解析的问题

问题来源

今天用SpringBoot中的Thymeleaf查询数据库中数据并进行分页,为了方便使用了easyui的datagrid,并通过脚本创建数据网格,但是一直报一个错误:无法解析datagrid的脚本语言。经过查询资料,解决方案如下:

原脚本如下:

<link rel="stylesheet" type="text/css" href="/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="/easyui/demo.css">
    <script type="text/javascript" src="/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/easyui/jquery.easyui.min.js"></script>
    <script>
        $(function(){
    
    
            $(function(){
    
    
                $('#usershow').datagrid({
    
    
                    url: 'user',
                    rownumbers:true,
                    pagination:true,
                    pageSize:2,
                    pageList:[2,4],
                    columns: [[
                        {
    
    field: 'uname', title: '用户名', width: 200,align:'center'},
                        {
    
    field: 'pwd',title: '密码',width: 200,align:'center'},
                        {
    
    field: 'phone', title: '手机号', width: 200,align:'center'}
                    ]]
                });
            });
        });

    </script>

问题如下:

There was an unexpected error (type=Internal Server Error, status=500).
Could not parse as expression:

 " {field: 'uname', title: '用户名', width: 200,align:'center'}, {field: 'pwd',title: '密码',width: 200,align:'center'}, {field: 'phone', title: '手机号', width: 200,align:'center'} " (template: "page" - line 20, col 32)

问题解决:

在中加一个th:inline="none"就可以解决了

在这里插入图片描述

虽然解决了,但还是不明白是为啥,若有大佬路过望解析。

猜你喜欢

转载自blog.csdn.net/weixin_44613100/article/details/106559960
今日推荐