xm-select/docs/mds/ZM06.md
2019-10-16 23:22:54 +08:00

944 B

远程搜索

layer弹出框

:::demo

<button class="btn" id="demo1-btn">弹出多选</button>

<script>
document.getElementById('demo1-btn').onclick = function(){
    layer.open({
        type: 1,
        title: '多选',
        content: '<div id="demo1" class="xm-select-demo-alert"></div>',
        success: function(layero, index){
            //这里因为内容过少, 会被遮挡, 所以简单修改了下样式
            document.getElementById('layui-layer' + index).getElementsByClassName('layui-layer-content')[0].style.overflow = 'unset';
            //渲染多选
            var demo1 = xmSelect.render({
                el: '#demo1', 
                data: [
                    {name: '张三', value: 1, selected: true},
                    {name: '李四', value: 2, disabled: true},
                    {name: '王五', value: 3},
                ]
            })
        }
    });
}
</script>

:::