Layui事件监听
- 官方提供了elemen.on和filter操作,但是公司统一监听为如下形式。
1 2 3
| <div class="layui-form-item"> <button class="layui-btn" data-method="functionConfig" title="功能配置" style="margin-left: 10px;">功能配置</button> </div>
|
1 2 3 4 5 6 7 8 9 10 11 12
| layui.use(['layer', 'form', 'admin'], function () { .................. $(document).on('click','.btn,.layui-btn',function () { var othis = $(this), method = othis.data('method'); active[method] ? active[method].call(this, othis) : ''; }); }
var active={ functionConfig: function () { } };
|
Welcome to my other publishing channels