layui自定义option多选样式

基础示例效果图

layui自定义option多选样式_第1张图片

//1.下载formSelects-v4

//2.模块化使用

<script src="layui.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    //全局定义一次, 加载formSelects
    layui.config({
        base: '../src/' //此处路径请自行处理, 可以使用绝对路径
    }).extend({
        formSelects: 'formSelects-v4'
    });
    //加载模块
    layui.use(['jquery', 'formSelects'], function(){
        var formSelects = layui.formSelects;
         
    });
</script>

//3.非模块化使用

<script src="layui.all.js" type="text/javascript" charset="utf-8"></script>
<script src="formSelects-v4.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    var formSelects = layui.formSelects;
     
</script>

html代码(css一定 要注意引入)

<link rel="stylesheet" href="plugs/layui/css/formSelects-v4.css">
<div class="layui-input-block">
    <select lay-verify="" required lay-verify="required" xm-select="vehicle_type_ids" required lay-verify="required">
        <option selected>option>
        <option>option>
    select> 
div>

你可能感兴趣的:(layui)