layer.load使用

layer.load(icon, options) - 加载层,详细了解文章《layer API帮助文档

load并不需要你传太多的参数,但如果你不喜欢默认的加载风格,你还有选择空间。icon支持传入0-2如果是0,无需传。另外特别注意一点:load默认是不会自动关闭的,因为你一般会在ajax回调体中关闭它。

代码如下:

//eg1
var index = layer.load();
//eg2
var index = layer.load(1); //换了种风格
//eg3
var index = layer.load(2, {time: 10*1000}); //又换了种风格,并且设定最长等待10秒 
//eg4
var indexLoad = layer.load(2, {shade:[0.5,'#fff']});//页面会有加载层
//关闭
layer.close(index);
layer.close(indexLoad);

使用这个页面需要引入layer.js.老版只要引入下面一个js就可以了,可参考《layer弹出层组件开发文档

<script type="text/javascript" src="${basePath?if_exists}/plugin/layer-v3.1.0/layer.js"></script>

实际需要改为自己项目中文件的路径

猜你喜欢

转载自blog.csdn.net/tao111369/article/details/84959618