Skip to content
On this page

警告

警告提示

放下她, 让我来!!! 默认颜色#e54d42, 多选上限的样色

js
/*
 *  COLOR: 自定义颜色, 默认是 options.theme.maxColor的颜色
 *  SUSTAIN: 是否持续显示, 默认为false
 */
xmSelectObj.warning(COLOR, SUSTAIN);
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>

自定义闪烁颜色

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>

持续显示

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>