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

How to use layui pop-up window

angryTom
Release: 2019-07-29 10:51:43
Original
5399 people have browsed it

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("这是点击取消按钮走的回调")
  });
})
Copy after login

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//字段类型
})
})
Copy after login

3: msg type

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

4: Close the pop-up window

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template