mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 09:14:27 +08:00
change minus sign to negative sign automatically
This commit is contained in:
@@ -146,6 +146,11 @@ export default {
|
|||||||
return `${integer}.${newDecimals}`;
|
return `${integer}.${newDecimals}`;
|
||||||
},
|
},
|
||||||
inputNum(num) {
|
inputNum(num) {
|
||||||
|
if (!this.previousValue && this.currentSymbol === '−') {
|
||||||
|
this.currentValue = '-' + this.currentValue;
|
||||||
|
this.currentSymbol = '';
|
||||||
|
}
|
||||||
|
|
||||||
if (this.currentValue === '0') {
|
if (this.currentValue === '0') {
|
||||||
this.currentValue = num.toString();
|
this.currentValue = num.toString();
|
||||||
return;
|
return;
|
||||||
@@ -187,6 +192,11 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.previousValue && this.currentSymbol === '−') {
|
||||||
|
this.currentValue = '-' + this.currentValue;
|
||||||
|
this.currentSymbol = '';
|
||||||
|
}
|
||||||
|
|
||||||
if (this.currentValue.length < 1) {
|
if (this.currentValue.length < 1) {
|
||||||
this.currentValue = '0';
|
this.currentValue = '0';
|
||||||
} else if (this.currentValue === '-') {
|
} else if (this.currentValue === '-') {
|
||||||
|
|||||||
Reference in New Issue
Block a user