Layui简介
1 Layui官网
https://layui.gitee.io/v2/docs/element/form.html
2 Layui表单开发注意事项
1)select切换事件的监听
form.on('select(group)', function (data) {
})
2)遮罩
let index = layui.layer.load(1, { title: '正在计算...', shade: [0.8, '#fff'] //0.1透明度的白色背景 });
3)修改radio的值
html
<div class="layui-input-inline"> <input type="radio" name="table_show" title="明细" value="1" id="table_show_1" checked lay-filter="table_show"> <input type="radio" name="table_show" title="汇总 value="2" id="table_show_2" lay-filter="table_show"> </div>
js
$("input[name=table_show][value='1']").prop("checked", true);
form.render('radio');
//render一定不能忘记,否则无法渲染
4)数值输入框的校验
<div class="layui-inline"> <label class="layui-form-label" for="actual_price"><span class="required-msg">*</span>实收价格</label> <div class="layui-input-inline"> <input type="text" name="actual_price" id="actual_price" min="0" number-mask="10,2" lay-verify="required" lay-verType="tips" autocomplete="off" class="layui-input number-format"> </div> </div> <!--class中添加number-format;type修改为text; number-mask的第一个值为整数位数,第二个值为小数位数;-->
浙公网安备 33010602011771号