<div class="layui-btn-group demoTable" style="float: right;">
<button class="layui-btn layui-btn-sm" data-type="test1" style="margin-right: 0px; margin-bottom: 0px;"><i class="layui-icon"></i>测试1</button>
<button class="layui-btn layui-btn-sm" data-type="test2" style="margin-right: 0px; margin-bottom: 0px;"><i class="layui-icon"></i>测试2</button>
<button type="submit" class="layui-btn layui-btn-sm" id="test3" lay-submit lay-filter="test3">测试3</button>
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="test4">测试4</button>
</div>
<script>
layui.use(['upload','form','laydate','table','layer'], function () {
var active = {
test1: function(){
layer.alert(1);
}
,test2: function(){
layer.alert(2);
}
};
$('.demoTable .layui-btn').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
form.on('submit(test3)', function (data) {
layer.alert(3)
});
}
</script>