Home >Web Front-end >Layui Tutorial >How to use layui pop-up window

How to use layui pop-up window

angryTom
angryTomOriginal
2019-07-29 10:51:435397browse

How to use layui pop-up window

If you want to know more about layui, you can click: layui tutorial

## There are three types of layui pop-up windows, namely: 1. Confim type; 2. Open type pop-up box; 3. Msg type. Let me introduce you one by one how to use these pop-up windows.

1: Confim type usage method

layui.use('layer', function(){
layer.confirm('是否立即上传卷宗信息?', {
    btn: ['是','否'],
    time: 200000, //20s后自动关闭
    },function(index){
        alert("这是点击确定按钮走的回调")
    layer.close(index);
  },function(){
     alert("这是点击取消按钮走的回调")
  });
})

2: Open type pop-up box, the content parameter can be a choice The device can also be a path

layer.open({
type : 1,
title : "借阅时间",
area : [ '450px', '300px' ],
content : $("#borrowCase"),
btn: ['确定', '取消'],
yes: function(index){
  alert("这是点击确定按钮走的回调")
},
btn2: function(){
   alert("这是点击取消按钮走的回调")
},
end:function(){
alert('这是点击任一按钮都会走的回调')
}
});
layui.use('layer',function(){
var layer=layui.layer;
layer.open({
type:2,
title:'新增字段信息',
area:['450px','300px'],
content: "dictionary/addFiled?dictionaryId="+dictionaryId//字段类型
})
})

3: msg type

layer.msg('添加借阅成功', {
    time: 1500, //1500ms后自动关闭
  });

4: Close the pop-up window

layer_close(index)关闭当前弹窗
parent.layer.closeAll()关闭所有的弹窗

The above is the detailed content of How to use layui pop-up window. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use layuiNext article:How to use layui