layui数据加载中遮罩层的实现

1、load方法提供三种风格供选择。

方法一:loadIndex = layer.load(); //不传参,默认0

方法二:loadIndex = layer.load(1); // 1,另外一种风格

方法三:loadIndex = layer.load(2,{time:10*1000}); //2,换一种风格;time设置最长等待时间

load默认不会关闭,需要在complete回调中关闭。

2、项目中调取接口时,如果等待时间过长,则需要设置

layui.use('upload', function(){
  upload = layui.upload;
  var loadIndex;
  upload.render({
    elem: '.upload'
    ,url: 'url'
     ,before: function(obj){//参数
      loadIndex = layer.load(2, { shade: [0.15, '#ccc'] });
} ,
done: function(res){
  layer.close(indexs);
}
});
});




原文:https://blog.csdn.net/g229191727/article/details/85163309

猜你喜欢

转载自www.cnblogs.com/yinyl/p/10916999.html