欢迎来到小懒的博客~email:568705236@qq.com

日常笔记,view ui Cascader,layui form

2020/9/16 16:39:16站长

    在iview 4 中使用Cascader时data中的节点,要么没有children属性,要么children赋值[]空数组,不然报错。


    在layui的form使用中,form是以拥有layui-form的类名来创建表单的处理,如果父节点存在layui-form的类名,无论其子节点是否有form标签或layui-form的类名,都会被忽略。

<div class="layui-form layui-card-header layuiadmin-card-header-auto"
                lay-filter="layadmin-useradmin-formlist">

                <form class="layui-form" id="sk-form" lay-filter="sk-form">
                    <div class="" style="padding: 20px 30px 0 0;">
                        <div class="layui-form-item">
                            <label class="layui-form-label">车主手机:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sk_mem_tel" id="sk_mem_tel" class="layui-input"
                                    readonly="readonly" placeholder="请选择车主" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button id="sk_submitMsg" class="layui-btn layui-btn-sm" lay-submit
                                    lay-filter="sk_submitMsg">确定收款</button>
                            </div>
                        </div>
                    </div>
                </form>
                <br />
                <form class="layui-form" id="tk-form" lay-filter="tk-form">
                    <div class=""  style="padding: 20px 30px 0 0;">
                        <div class="layui-form-item">
                            <label class="layui-form-label">车主手机:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="tk_mem_tel" id="tk_mem_tel" class="layui-input"
                                    readonly="readonly" placeholder="请选择车主" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button id="tk_submitMsg" class="layui-btn layui-btn-sm" lay-submit
                                    lay-filter="tk_submitMsg">确定退款</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>

    想上面的例子就是最外层的div.layui-form被当作表单处理,所以里面的两个按钮点击都会触发第一个form元素中的输入框的验证。需要把最外层的div.layui-form移除类名,两个form才会被当作两个表单处理。

赞赏