<form class="layui-form">
<div class="layui-form-item">
<input type="text" id="subTitle" name="subTitle" lay-verify="required" class="layui-input">
</div>
<div class="layui-form-item">
<button class="layui-btn" lay-submit lay-filter="formDemo">添加</button>
</div>
</form>
form标签上添加上 class="layui-form"
属性
button按钮添加上 lay-filter = "formDemo"
属性
form.on('submit(formDemo)', function (data) {
layer.msg(JSON.stringify(data.field)); //JSON.stringify(data.field): 表单中所有的数据
})