You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<div class="layui-btn-container">
|
|
|
|
<button type="button" class="layui-btn layui-btn-primary" lay-on="test-load-1">风格1</button>
|
|
|
|
<button type="button" class="layui-btn layui-btn-primary" lay-on="test-load-2">风格2</button>
|
|
|
|
<button type="button" class="layui-btn layui-btn-primary" lay-on="test-load-3">风格3</button>
|
|
|
|
<button type="button" class="layui-btn layui-btn-primary" lay-on="test-load-4">风格4</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- import layui -->
|
|
|
|
<script>
|
|
|
|
layui.use(function(){
|
|
|
|
var layer = layui.layer;
|
|
|
|
var util = layui.util;
|
|
|
|
|
|
|
|
// 事件
|
|
|
|
util.on('lay-on', {
|
|
|
|
'test-load-1': function(){
|
|
|
|
var loadIndex = layer.load(0);
|
|
|
|
// 模拟关闭
|
|
|
|
setTimeout(function(){
|
|
|
|
layer.close(loadIndex)
|
|
|
|
}, 3000);
|
|
|
|
},
|
|
|
|
'test-load-2': function(){
|
|
|
|
var loadIndex = layer.load(1);
|
|
|
|
// 模拟关闭
|
|
|
|
setTimeout(function(){
|
|
|
|
layer.close(loadIndex)
|
|
|
|
}, 3000);
|
|
|
|
},
|
|
|
|
'test-load-3': function(){
|
|
|
|
var loadIndex = layer.load(2);
|
|
|
|
// 模拟关闭
|
|
|
|
setTimeout(function(){
|
|
|
|
layer.close(loadIndex)
|
|
|
|
}, 3000);
|
|
|
|
},
|
|
|
|
'test-load-4': function(){
|
|
|
|
var loadIndex = layer.msg('加载中', {
|
|
|
|
icon: 16,
|
|
|
|
shade: 0.01
|
|
|
|
});;
|
|
|
|
// 模拟关闭
|
|
|
|
setTimeout(function(){
|
|
|
|
layer.close(loadIndex)
|
|
|
|
}, 3000);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
</script>
|