<div class="layui-form-item">
<button class="layui-btn layui-btn-fluid"
lay-submit lay-filter="login-submit">登 入</button>
</div>
//登录逻辑
$(function () {
//监听提交(data 表单属性对象)
layui.use(['form','layer'], function(){
var form = layui.form;
var layer = layui.layer;
form.on('submit(login-submit)', function(data){
$.ajax({
type:'post',
url:'/login',
data:data.field,
success:function (data) {
if (data.success){
layer.msg('登录成功', {icon: 6});
setTimeout("location.replace('/toIndex')",1000);
}else{
layer.msg(data.message,{icon: 5});