layer open div 注意事項

沐雪大神發表於2020-11-02

1、要彈窗的div,一般需要隱藏,隱藏必須加 display:none;

比如

<div  style="display:none;" id="settingXiangou_show_div">
        <div class="dialog-form clearfix" >
            <div class="form-group ">
                <label class="label-inline fl" for=""><span class="red">*</span>限購:</label>
                <div class="col-sm-4">
                    <ul class="list-unstyled mb-0">

                        <li class="d-inline-block " id="xiangou_num_type">
                            <select class="form-control  " id="max_buy_count_type" name="max_buy_count_type">
                                <option value="0" >不限購</option>
                                <option value="1" >每天</option>
                                <option value="2" >每週</option>
                                <option value="3" >每月</option>
                                <option value="4">每年</option>
                                <option value="5">永久</option>
                            </select>
                        </li>
                        <li class="d-inline-block hide" id="xiangou_num">

                            <div class="input-group  input-group-sm w120">
                                <input class="form-control input-sm  inline"  id="max_buy_count">
                                <div class="input-group-append">
                                    <span class="input-group-text">件</span>
                                </div>
                            </div>
                        </li>
                    </ul>

                    <div class="color-9 mt10">預設不限購,可限制每人可購買數量</div> 
                </div>

            </div>
        </div>
    </div>

2、layer方法

 layer.open({
        type: 1,
        area: ['450px', '200px'],
        title: '批量設定限購',
        btn: ['確定', '取消'],//按鈕
        content: $('#settingXiangou_show_div'),
        yes: function (index, layero) {}
});

 

相關文章