zoukankan      html  css  js  c++  java
  • layui-弹出层

    1. 

    //弹框中的表单
    <form class="add" lay-filter="addform" id="addform" style="display: none;">
            <div class="layui-form-item">
                <label class="layui-form-label">用户名</label>
                <div class="layui-input-block">
                    <input type="text" name="username" placeholder="请输入" autocomplete="off" class="layui-input" lay-filter="username">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">复选框</label>
                <div class="layui-input-block">
                    <input type="checkbox" name="like[write]" value="write" title="写作" >
                    <input type="checkbox" name="like[read]" value="read" title="阅读" >
                </div>
            </div>
        </form>
    

    2. 

    layui.use('layer', function(){
            var layer = layui.layer;
            
            layer.open({
                title: ['title', 'text-align:center; background:#fff'],
                type: 1, 
                area: ['500px', '300px'],
                content: $('#addform'), //这里content是一个普通的String
                // offset: 'auto', //弹框位置
                btn: ['no', 'yes']
                ,btnAlign: 'c'
                ,btn1: function(index, layero){
                    alert('no')
              layer.closeAll(type) - 关闭所有层 } ,btn2:
    function(index, layero){ alert('yes') //return false 开启该代码可禁止点击该按钮关闭 } ,cancel: function(){ //右上角关闭回调 //return false 开启该代码可禁止点击该按钮关闭 } ,success: function(layero, index){ //弹出成功的回调 console.log('弹出了'+layero, index); } }); });
  • 相关阅读:
    Python之路,day16-Python基础
    Python之路,day15-Python基础
    Python之路,day14-Python基础
    django之model操作
    django信号
    django缓存
    CSRF的攻击与防范
    cookie和session
    http协议之Request Headers
    ajax参数详解
  • 原文地址:https://www.cnblogs.com/xhrr/p/11691549.html
Copyright © 2011-2022 走看看