<div class="layui-form-item">
<label class="layui-form-label">开关</label>
<div class="layui-input-block">
<input type="checkbox" name="switch" lay-skin="switch" lay-text="开启|关闭" id="switch">
</div>
</div>
// 设置 Switch 开关为开启状态
$("#switch").prop("checked", true);
// 设置 Switch 开关为关闭状态
$("#switch").prop("checked", false);
// 重新渲染
form.render("checkbox");