diff --git a/dev/components/form/numeric.vue b/dev/components/form/numeric.vue index ef829bf5a37..dbb836eee36 100644 --- a/dev/components/form/numeric.vue +++ b/dev/components/form/numeric.vue @@ -5,9 +5,15 @@ Model {{number}}   ({{min}}-{{max}}) -

Standalone

+

Default

+

With Step 4

+ + +

With Step 0.2 & Maximum decimals 2

+ +

Disabled State

@@ -44,6 +50,7 @@ export default { data () { return { number: 3, + numberPrecision: 5.15, min: 1, max: 1017 } diff --git a/src/vue-components/numeric/Numeric.vue b/src/vue-components/numeric/Numeric.vue index 2065588fb08..136ddb71ba6 100644 --- a/src/vue-components/numeric/Numeric.vue +++ b/src/vue-components/numeric/Numeric.vue @@ -33,7 +33,11 @@ export default { min: Number, max: Number, readonly: Boolean, - disable: Boolean + disable: Boolean, + maxDecimals: { + type: Number, + default: 0 + } }, watch: { value () { @@ -53,7 +57,8 @@ export default { else if (typeof this.max === 'number' && value > this.max) { return this.max } - return value + + return parseFloat(this.maxDecimals ? parseFloat(value).toFixed(this.maxDecimals) : value) }, __updateValue () { this.model = this.__normalize(this.model)