Skip to main content

弹框中的多选

layer弹出框

<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>