layer提示手机版

layer提示移动端

文档:https://www.layui.site/layer/mobile/api.html
示例:https://www.layui.site/layer/mobile/index.htm

type-设置弹层的类型 类型:Number 默认:0 (0表示信息框,1表示页面层,2表示加载层)
skin-设定弹层显示风格 类型:String 目前支持配置 footer(即底部对话框风格)、msg(普通提示) 两种风格。
shade-控制遮罩展现 类型:String/Boolean 默认:true,该参数可允许你是否显示遮罩,并且定义遮罩风格

//提示框
layer.open({
    type: 0
    ,title: '提示'
    ,content: '请输入你需要查询的内容!'
    ,btn: '关闭'
    // ,shade: false //不显示遮罩
    ,yes: function(index){
        layer.close(index);
    }
});


//提示
layer.open({
    content: '这是提示的内容!'
    ,skin: 'msg'
    ,time: 2 //2秒后自动关闭
});


//信息框
layer.open({
    content: '这是提示的内容!'
    ,btn: '关闭'
});

//失败---提示框
layer.open({
    content: data.error
    ,btn: '关闭'
});


//成功---提示框
layer.open({
    content: data.success
    ,btn: '关闭'
    ,yes: function(index){
        layer.close(index);
        window.location.reload();
    }
});

//信息框
layer.open({
    content: '这是提示的内容!'
    ,btn: '关闭'
    ,yes: function(index){
        layer.close(index);
       
    }
});


//登录--询问框
layer.open({
    type: 0
    ,title: '提示'
    ,content: '您已离线,请先登录?'
    ,btn: ['登录', '取消']
    ,yes: function(index){
        layer.close(index);

        window.location.href = "";
       
    }
});


//询问框
layer.open({
    type: 0
    ,title: '提示'
    ,content: '询问内容?'
    ,btn: ['确定', '取消']
    ,yes: function(index){
        layer.close(index);
       
    }
});

你可能感兴趣的:(前端的坑,手机,javascript,前端)