提交 d1347f34 编写于 作者: WodahsOrez's avatar WodahsOrez

lxm--浮点数精度

上级 2373f652
<template>
<div class="input-unit">
<i-input
<InputNumber v-if="type === 'number'"
:placeholder="placeholder"
:size="size"
:precision="precision"
v-model="CurrentVal"
:disabled="disabled ? true : false"
></InputNumber>
<i-input v-else
:placeholder="placeholder"
:size="size"
:type="type"
......@@ -63,6 +70,14 @@ export default class InputBox extends Vue {
*/
@Prop() public type?: string;
/**
* 精度
*
* @type {number}
* @memberof InputBox
*/
@Prop({default: 0}) public precision?: number;
/**
* 多行文本行数
*
......@@ -77,7 +92,11 @@ export default class InputBox extends Vue {
* @memberof InputBox
*/
get CurrentVal() {
return this.itemValue;
if(Object.is(this.type, 'number') && this.itemValue && !isNaN(this.itemValue)){
return Number(Number(this.itemValue).toFixed(this.precision));
}else{
return this.itemValue;
}
}
/**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册