fixed #1810
This commit is contained in:
parent
36a9157947
commit
7a05b6e5f9
2 changed files with 12 additions and 3 deletions
|
@ -6,7 +6,8 @@
|
|||
<!--<div @click="changeMax">change max</div>-->
|
||||
<!--<Input-number disabled :max="10" :min="1" :step="1.2" v-model="v2"></Input-number>-->
|
||||
<!--<Input-number :max="10" :min="1" v-model="obj.v"></Input-number>-->
|
||||
<InputNumber :max="10" :min="1" v-model="value1"></InputNumber>
|
||||
{{ value1 }}
|
||||
<InputNumber :precision="1" :max="10" :min="1" :step="0.1" v-model="value1"></InputNumber>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -21,7 +22,7 @@
|
|||
obj: {
|
||||
|
||||
},
|
||||
value1: 1
|
||||
value1: 1.0
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
@keydown.stop="keyDown"
|
||||
@change="change"
|
||||
:name="name"
|
||||
:value="currentValue">
|
||||
:value="precisionValue">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -98,6 +98,9 @@
|
|||
},
|
||||
name: {
|
||||
type: String
|
||||
},
|
||||
precision: {
|
||||
type: Number
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
@ -151,6 +154,10 @@
|
|||
},
|
||||
inputClasses () {
|
||||
return `${prefixCls}-input`;
|
||||
},
|
||||
precisionValue () {
|
||||
// can not display 1.0
|
||||
return this.currentValue.toFixed(this.precision);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -208,6 +215,7 @@
|
|||
this.setValue(val);
|
||||
},
|
||||
setValue (val) {
|
||||
val = Number(Number(val).toFixed(this.precision));
|
||||
this.$nextTick(() => {
|
||||
this.currentValue = val;
|
||||
this.$emit('input', val);
|
||||
|
|
Loading…
Add table
Reference in a new issue