Commit 067a9be7 authored by 杨奕's avatar 杨奕 Committed by GitHub

Slider: warn against min being greater than max (#9997)

parent 12b6a10f
...@@ -193,6 +193,10 @@ ...@@ -193,6 +193,10 @@
} }
}, },
setValues() { setValues() {
if (this.min > this.max) {
console.error('[Element Error][Slider]min should not be greater than max.');
return;
}
const val = this.value; const val = this.value;
if (this.range && Array.isArray(val)) { if (this.range && Array.isArray(val)) {
if (val[1] < this.min) { if (val[1] < this.min) {
...@@ -269,7 +273,7 @@ ...@@ -269,7 +273,7 @@
computed: { computed: {
stops() { stops() {
if (!this.showStops) return []; if (!this.showStops || this.min > this.max) return [];
if (this.step === 0) { if (this.step === 0) {
process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'production' &&
console.warn('[Element Warn][Slider]step should not be 0.'); console.warn('[Element Warn][Slider]step should not be 0.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment