layui中cheched控件
2018-10-17 13:38 马尔代夫_珍 阅读(438) 评论(0) 编辑 收藏 举报 <form class="layui-form" >
<div class="layui-form-item">
<label class="layui-form-label">复选框</label>
<div class="layui-input-block">
<input type="checkbox" name="like[write]" title="写作">
<input type="checkbox" name="like[read]" title="阅读" checked="">
<input type="checkbox" name="like[game]" title="游戏">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">原始复选框</label>
<div class="layui-input-block">
<input type="checkbox" name="like1[write]" lay-skin="primary" title="写作" checked="">
<input type="checkbox" name="like1[read]" title="阅读">
<input type="checkbox" name="like1[game]" lay-skin="primary" title="游戏" disabled="">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">开关-默认关</label>
<div class="layui-input-block">
<input type="checkbox" name="close" lay-text="ON|OFF">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">开关-默认开</label>
<div class="layui-input-block">
<input type="checkbox" checked="" name="open" lay-skin="switch" lay-filter="switchTest" lay-text="ON|OFF">
</div>
</div>
</form>
<script>
layui.use('form', function () {
var form = layui.form;
form.render('select'); //刷新select选择框渲染
//各种基于事件的操作,下面会有进一步介绍
});
</script>
总结:开关按钮是checked按钮,checked和disabled惯用样式,lay-skin="switch"是layui样式设置。
https://www.layui.com/demo/form.html