20e535ac90
#### 新增 - 新增`disabled`配置, 可以禁用多选 - 新增`create`配置, 可以创建条目, 具体见 [创建条目](https://maplemei.gitee.io/xm-select/#/example/XM27) - 方法`warning`新增参数`sustain`, 可以配置是否持续显示 - 新增全局`get`方法, 可以获取多选渲染后的对象 - 新增全局`batch`方法, 可以批量给渲染后的多选执行方法 #### Bug fixes - 修复`update`方法, 会使已选中数据丢失的问题 - 修复`Safari`浏览器下, 搜索框无法聚焦的问题
89 lines
1.6 KiB
Markdown
89 lines
1.6 KiB
Markdown
## 警告
|
|
|
|
|
|
### 警告提示
|
|
|
|
放下她, 让我来!!! 默认颜色`#e54d42`, 多选上限的样色
|
|
|
|
```
|
|
/*
|
|
* COLOR: 自定义颜色, 默认是 options.theme.maxColor的颜色
|
|
* SUSTAIN: 是否持续显示, 默认为false
|
|
*/
|
|
xmSelectObj.warning(COLOR, SUSTAIN);
|
|
```
|
|
|
|
|
|
:::demo
|
|
```html
|
|
<div id="demo1" class="xm-select-demo"></div>
|
|
<button class="btn" id="demo1-warning">警告</button>
|
|
|
|
<script>
|
|
var demo1 = xmSelect.render({
|
|
el: '#demo1',
|
|
data: [
|
|
{name: '张三', value: 1, selected: true},
|
|
{name: '李四', value: 2},
|
|
{name: '王五', value: 3, disabled: true},
|
|
]
|
|
})
|
|
|
|
document.getElementById('demo1-warning').onclick = function(){
|
|
demo1.warning();
|
|
}
|
|
</script>
|
|
```
|
|
:::
|
|
|
|
|
|
### 自定义闪烁颜色
|
|
|
|
:::demo
|
|
```html
|
|
<div id="demo2" class="xm-select-demo"></div>
|
|
<button class="btn" id="demo2-warning">警告</button>
|
|
|
|
<script>
|
|
var demo2 = xmSelect.render({
|
|
el: '#demo2',
|
|
data: [
|
|
{name: '张三', value: 1, selected: true},
|
|
{name: '李四', value: 2},
|
|
{name: '王五', value: 3, disabled: true},
|
|
]
|
|
})
|
|
|
|
document.getElementById('demo2-warning').onclick = function(){
|
|
demo2.warning('#6739b6');
|
|
}
|
|
</script>
|
|
```
|
|
:::
|
|
|
|
|
|
### 持续显示
|
|
|
|
:::demo
|
|
```html
|
|
<div id="demo3" class="xm-select-demo"></div>
|
|
<button class="btn" id="demo3-warning">警告</button>
|
|
|
|
<script>
|
|
var demo3 = xmSelect.render({
|
|
el: '#demo3',
|
|
data: [
|
|
{name: '张三', value: 1, selected: true},
|
|
{name: '李四', value: 2},
|
|
{name: '王五', value: 3, disabled: true},
|
|
]
|
|
})
|
|
|
|
document.getElementById('demo3-warning').onclick = function(){
|
|
demo3.warning('#6739b6', true);
|
|
}
|
|
</script>
|
|
```
|
|
:::
|
|
|