diff --git a/dist/stepper/index.js b/dist/stepper/index.js index 247eece8..b1836ea4 100644 --- a/dist/stepper/index.js +++ b/dist/stepper/index.js @@ -53,7 +53,9 @@ VantComponent({ if (typeof newValue === 'number' && +this.data.value !== newValue) { this.set({ value: newValue }); } - } + }, + max: 'check', + min: 'check', }, data: { focus: false @@ -64,6 +66,12 @@ VantComponent({ }); }, methods: { + check() { + const newValue = this.range(this.data.value); + if (typeof newValue === 'number' && +this.data.value !== newValue) { + this.set({ value: newValue }); + } + }, onFocus(event) { this.$emit('focus', event.detail); }, diff --git a/lib/stepper/index.js b/lib/stepper/index.js index 3ee5b445..6ea1a5ec 100644 --- a/lib/stepper/index.js +++ b/lib/stepper/index.js @@ -55,7 +55,9 @@ component_1.VantComponent({ if (typeof newValue === 'number' && +this.data.value !== newValue) { this.set({ value: newValue }); } - } + }, + max: 'check', + min: 'check', }, data: { focus: false @@ -66,6 +68,12 @@ component_1.VantComponent({ }); }, methods: { + check: function () { + var newValue = this.range(this.data.value); + if (typeof newValue === 'number' && +this.data.value !== newValue) { + this.set({ value: newValue }); + } + }, onFocus: function (event) { this.$emit('focus', event.detail); },