js中免不了的要用的数组,一维的二维的三维的

但是当用到thymeleaf作为模版时候会有一些坑,导致数组不能用

org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "
{checkbox: true, fixed: true}
, {field: 'originalFileName', title: '文件名', width: , sort: true}
, {field: 'fileType', title: '文件类型', width: }
, {field: 'fileSize', title: '文件大小', width: , sort: true}
, {field: 'createTime', title: '上传时间', width: , sort: true}
, {field: 'dpStatus', title: '数据处理状态', width: , templet: '#statusTpl', sort: true}
, {field: 'updateTime', title: '数据处理完成时间', width: , templet: '#updateTimeTpl', sort: true}
, {fixed: 'right', title: '操作', align: 'center', width: , toolbar: '#operating'}
" (template: "textManagement" - line 125, col 22)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:)
at org.thymeleaf.engine.EngineEventUtils.parseAttributeExpression(EngineEventUtils.java:)

这里只接触最外层异常,而出现异常的位置

<script>
var cols=[[
{field:'checkBox',checkbox: true, fixed: true}
,{field:'username', title: '用户名'} //width 支持:数字、百分比和不填写。你还可以通过 minWidth 参数局部定义当前单元格的最小宽度,layui 2.2.1 新增
,{field:'mobile', title: '手机号', sort: true}
,{field:'nickname', title: '昵称'}
,{field:'lastLoginTime', title: '最后登录时间'}
,{field:'ip', title: '最后登录ip', align: 'center'} //单元格内容水平居中
,{field:'op',title: '操作', align:'center', toolbar: '#toolBars'} //这里的toolbar值是模板元素的选择器
]];
</script>

thymeleaf会把[[]]中的内容作为内联取值块解析,而不是数组。可以在cols的后面换行

解决办法:
方法一:回车换行如下:

, cols: [
[ //表头
{field: 'xxx', title: 'ID', width: , sort: true, fixed: 'left'}
, {field: 'xxx', title: '记录日期', width: }
, {field: 'xxx', title: '操作人ID', width: , sort: true}
, {field: 'xxx', title: '', width: }
, {field: 'xxx', title: '签名', width: }
, {field: 'xxx', title: '积分', width: , sort: true}
, {field: 'xxx', title: '评分', width: , sort: true}
, {field: 'xxx', title: '职业', width: }
, {field: 'xxx', title: '财富', width: , sort: true}
]
]

方法二:或者在script标签里 th:inline="none" 就可以了,默认是th:inline="text"

<script th:inline="none">
</script>

thymeleaf 使用javascript定义数组报错的更多相关文章

  1. JavaScript实现弹窗报错

    JavaScript实现弹窗报错 1.具体错误如下 SCRIPT 5022:cannot call methods on dialog prior to initialization; attempt ...

  2. java使用类数组 报错Exception in thread "main" java.lang.NullPointerException

    源代码如下: Point[] points=new Point[n];//Point是一个类 for(int i=0;i<n;i++) { System.out.print("请输入x ...

  3. springAOP注解方式定义切入点报错error at ::0 can't find referenced pointcut

    [说明] 1.使用spring版本:4.0.4 2.springAOP相关依赖包: 1)aopalliance-1.0.jar 2)aspectjweaver-1.8.9.jar 3)aspectjr ...

  4. mybatis问题。foreach循环遍历数组报错情况,及其解决方法

    根据条件查询数据列表,mybatis查询代码如下 如果只查询属于特定部门拥有的数据权限.这需要用 String[ ] codes保存当前部门及其子部门的部门编码. 所以需要在mybatis中遍历编码数 ...

  5. 解决关于ARM_MATH数学库宏定义的报错

    昨天在建立新工程的时候发现加入含有ARM_MATH库的时候出现了宏定义报错. #error directive:"Define according the used Cortex core ...

  6. mysql 创建函数或者存储过程,定义变量报错

    报错的原因是因为在过程或者函数中存在分隔符 分号(:),而mysql中默认分隔符也是 :,这就导致存储过程分开了 在存储过程外面包一层 delimiter //   code  //就行了

  7. Arcgis Javascript中geometryEngine报错’hq‘of undefined的解决方法

    这个问题困扰了我一个星期,原因是使用geomagicbuffer时候,有的线可正常使用,有的就直接报错,一直没有解决,后来发现是api自己的bug导致的 干脆直接读代码,在geometryEngine ...

  8. NSUserDefaults保存对象数组报错

    在使用NSUserDefaults的时候插入数据有时候会报以下错误:Attempt to set a non-property-list objec 这种错误的原因是插入了不识别的数据类型,NSUse ...

  9. <JavaScript>调用apply报错:CreateListFromArrayLike called on non-object;

    Function.apply(obj, args)方法能接收两个参数 obj:这个对象将代替Function类里this对象 args:这个是数组,它将作为参数传给Function(args--> ...

随机推荐

  1. Smarty常用函数

    1 .include_once语句: 引用文件路径,路径必需正确.   eg:include_once("smarty/Smarty.class.php"); 2 $smarty= ...

  2. kendo ui - DatePicker 日期时间系列

    kendo-ui 官网:https://www.telerik.com/documentation 初始化 grid: 引入文件: <link rel="stylesheet" ...

  3. Docker实战(十)之分布式处理与大数据平台

    分布式系统和大数据处理平台是目前业界关注的热门技术. 1.RabbitMQ RabbitMQ是一个支持AMQP的开源消息队列实现,由Erlang编写,因以高性能.高可用以及可伸缩性出名.它支持多种客户 ...

  4. 关于lora标配SPDT大功率射频开关

    SPDT大功率的UltraCMOS ™DC - 3.0 GHz射频开关              PE4259的UltraCMOS ™射频开关被设计为覆盖广泛的,通过3000兆赫从近DC应用.这种反射 ...

  5. VMware虚拟机更换根用户( su: Authentication failure问题)

    su命令不能切换root,提示su: Authentication failure,只要你sudo passwd root过一次之后,下次再su的时候只要输入密码就可以成功登录了.

  6. 1349: Taking Pebbles (博弈 打表找规律)

    1349: Taking Pebbles Submit Page    Summary    Time Limit: 1 Sec     Memory Limit: 128 Mb     Submit ...

  7. transform CSS3 2D知识点汇总

    transform转换属性的5个值: 1. translate(x值,y值)  移动效果. 2.rotate(45deg)  旋转效果. 3.scale(x轴倍数,y轴倍数)  缩放效果. 4.ske ...

  8. 部署MongoDB复制集(副本集)

    环境 操作系统:Ubuntu 18.04 MongoDB: 4.0.3 服务器 首先部署3台服务器,1台主节点 + 2台从节点 3台服务器的内容ip分别是: 10.140.0.5 (主节点) 10.1 ...

  9. MepReduce-开启大数据计算之门

    Hadoop MapReduce是一种编程模型,用于大规模数据集(大于1TB)的并行运算.早期的MapReduce(MR)框架简单明了,JobTracker作为MR框架的集中处理点,随着分布式系统集群 ...

  10. hisi3559的usb无线网卡驱动(rtl8192cu)(一条龙服务:内核编译、驱动编译、iw等工具编译)

    usb无线网卡驱动(rtl8192cu) 内核编译.驱动编译.iw等工具编译  (哈哈,如果有其他问题,麻烦留言:) 环境 板卡:hi3559av100(arm64) 交叉编译链:aarch64-hi ...