change minus sign to negative sign automatically

This commit is contained in:
MaysWind
2020-12-18 01:35:27 +08:00
parent d8b39f327f
commit 2adb8f8922
+10
View File
@@ -146,6 +146,11 @@ export default {
return `${integer}.${newDecimals}`;
},
inputNum(num) {
if (!this.previousValue && this.currentSymbol === '') {
this.currentValue = '-' + this.currentValue;
this.currentSymbol = '';
}
if (this.currentValue === '0') {
this.currentValue = num.toString();
return;
@@ -187,6 +192,11 @@ export default {
return;
}
if (!this.previousValue && this.currentSymbol === '') {
this.currentValue = '-' + this.currentValue;
this.currentSymbol = '';
}
if (this.currentValue.length < 1) {
this.currentValue = '0';
} else if (this.currentValue === '-') {