报错信息如下:
layui.all.js:5 Uncaught TypeError: Cannot read property 'parents' of null
at VM3027 layui.all.js:5
at VM3027 layui.all.js:5
at VM3027 layui.all.js:5
at s.pt.vessel (VM3027 layui.all.js:5)
at s.pt.creat (VM3027 layui.all.js:5)
at new s (VM3027 layui.all.js:5)
at Object.r.open (VM3027 layui.all.js:5)
at Object.alert (VM3027 layui.all.js:5)
at Object.success (curdtools.js:102)
at u (jquery-3.3.1.min.js:2)
原因:下面代码中layer.alert(result.content)
中的content是个null
layForm.on('submit('+submitBtnLayFilter+')', function(data) {
$.post(url, data.field, function(result) {
if (result.type == 'success') {
layer.close(modalIndex);
table.reload(tableId, {});
layer.alert(result.content);//原因是这里的result.content 是null
} else {
layer.alert(result.content);
}
}, 'json');
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
});