From 2adb8f8922f09c4195e7b010afd4491b5bcb9acc Mon Sep 17 00:00:00 2001 From: MaysWind Date: Fri, 18 Dec 2020 01:35:27 +0800 Subject: [PATCH] change minus sign to negative sign automatically --- src/components/mobile/NumberPadSheet.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/mobile/NumberPadSheet.vue b/src/components/mobile/NumberPadSheet.vue index 1d75dcc9..aeba5855 100644 --- a/src/components/mobile/NumberPadSheet.vue +++ b/src/components/mobile/NumberPadSheet.vue @@ -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 === '-') {