layui 的一些小技巧写法如:select默认选择,时间选择插件
更新:HHH   时间:2023-1-7


                        <div class="layui-form-item">
                            <label class="layui-form-label">选择广告位置</label>
                            <div class="layui-input-inline"   >
                                <select name="adv_site" id="siteid" lay-filter="pid">
                                    <option value="n">全部</option>
                                    {loop $advsite_list  $v}
                                    <option value=""></option>
                                    <option value="{$v['site_id']}"> {$v['site_name']}</option>
                                    {/loop}
                                </select>
                            </div>
                        </div>

<script>
layui.use("list");
layui.use(['myform'],function () {
var form = layui.form();
var laydate = layui.laydate;
//日期时间选择器
laydate.render({
elem: '#starttime',
type: 'datetime'
});

            laydate.render({
                elem: '#endtime',
                type: 'datetime'
            });

            $("#siteid").val({$type});//默认选择上面select的值 经常用到的
            $("#expense_type").val({$expense_type});
            form.render('select');

        });
                    </script>
返回web开发教程...