1.layer.confirm('一個月只能申請5次修改\n' +
'審核將會在7個工作日內完成,請確認是否提交修改申請?', {
btn: ['確定','取消'], //按鈕
title:'提示',
}, function(){
console.log('點了確定');
layer.msg('修改成功', {icon: 1,time:1500,end:function () {
// window.location.href="<?=url('miniapp/index')?>"; //跳轉到指定頁面
window.location.reload(); // 刷新頁面
}});
layer.msg(info, {icon: 2,time:1800});
}, function(){
layer.closeAll(); // 關閉彈窗
});
2.icon 1 打勾,2 打叉。
3.layer.msg('請先輸入功能介紹'); //沒有帶icon的msg,是灰色透明的彈窗
4.layer.alert('測試'); // 帶頭部和確認的彈窗
5.layer.msg('提示內容', {icon: 2,time:1800}); //默認是2秒關閉。 沒帶確認鍵的彈窗
6.layer.alert('一次只能添加一個類目',{title:'提示'}); // 帶頭部和確認的彈窗,自定義title
7. var index = layer.load(0, {shade: false}); //0代表加載的風格,支持0-2
8. layer.load(0, {shade: [0.1,'#fff']}); //0代表加載的風格,支持0-2 有透明層不能點擊
9. layer.closeAll('loading'); // 關閉加載框
10. 彈窗中加入代碼
layer.open({
type: 1,
title: '打印預覽',
skin: 'layui-layer-rim', //加上邊框
area: ['726px', '595px'], //寬高
content: $(this).siblings('.print_box')
})
11.
//iframe窗
layer.open({
type: 2, //type=2是打開頁面地址,type=1是打開html標簽
title: false,
closeBtn: 0, //不顯示關閉按鈕
shade: [0],
area: ['340px', '215px'],
offset: 'rb', //右下角彈出
time: 2000, //2秒后自動關閉
anim: 2,
content: ['test/guodu.html', 'no'], //iframe的url,no代表不顯示滾動條
end: function(){ //此處用於演示
}
});
layer.open({
type: 1,
title: '很多時候,我們想最大化看,比如像這個頁面。',
shadeClose: true, // 點擊蒙層是否可關閉
shade: false, //背景蒙層,0.4
maxmin: true, //開啟最大化最小化按鈕
area: ['893px', '600px'],
content: '//fly.layui.com/' // 或 $('#content')
});