报错信息:
bomFile.js:475 Uncaught TypeError: Cannot read property 'substring' of undefined
at HTMLAnchorElement.<anonymous> (bomFile.js:475)
at Function.s (layui.js:2)
at r.each (layui.js:2)
at Array.<anonymous> (layui.js:2)
at r.each (layui.js:2)
at HTMLAnchorElement.r.event.r.event (layui.js:2)
at HTMLAnchorElement.<anonymous> (table.js?v=1575889601624:2)
at HTMLDivElement.dispatch (jquery.js?v=1575889601624:3)
at HTMLDivElement.m.handle (jquery.js?v=1575889601624:3)
代码:
var format = file_name.substring(file_name.length - 3, file_name.length);
原因分析: 本来运行得好好的,改了个字段就报错了。后来发现还是字段的问题。file_name写错了,导致获取的值为空,无法使用substring方法。