2019-11-22 20:33:17 +08:00
|
|
|
## 弹框中的多选
|
2019-11-19 20:13:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
### layer弹出框
|
|
|
|
|
|
|
|
:::demo
|
|
|
|
```html
|
|
|
|
<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>
|
|
|
|
```
|
|
|
|
:::
|