layer数据加载中,loading的显示
1.layer中的数据加载中layer.load
loadIndex = layer.load(2,{time:20*1000});
layer.load()参数选填,
第一个参数为样式参数,默认0,还有1,2;time设置最长等待时间20秒,
有返回结果时在success中调用layer.close(loadIndex);关闭加载中的提示弹窗
2.实际调用
$.ajax({
type: "get",
url: _url,
cache:false,
dataType:"json",
beforeSend:function(){
//显示正在加载数据
loadIndex = layer.msg('读取中,请稍候...', {icon: 16,time:20*1000});
},
success: function(result){
layer.close(loadIndex);
if(result.code == 200){
layer.open({
type: 1,
skin: 'layui-layer-rim', //加上边框
area: ['50%', '60%'], //宽高
content: '返回内容'
});
}else {
layer.alert('暂无数据');
}
}
});