Skip to content

Commit 50df7c4

Browse files
committed
Clearing the input field sets undefined instead of 0
1 parent c1135b1 commit 50df7c4

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/bignum_input.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@
6666
},
6767
watch: {
6868
val(val){
69+
if(!val){
70+
this.$emit('change', new BN(0));
71+
return
72+
}
6973
70-
//
7174
try{
7275
let splitVal = val.toString().split('.')
7376
let wholeVal = splitVal[0]
@@ -88,11 +91,6 @@
8891
return
8992
}
9093
91-
if(!val){
92-
this.$emit('change', new BN(0));
93-
return
94-
}
95-
9694
let valBn = this.stringToBN(val)
9795
this.$emit('change', valBn);
9896
},
@@ -116,7 +114,7 @@
116114
}
117115
},
118116
clear(){
119-
this.val = 0
117+
this.val = undefined
120118
},
121119
onChange(){
122120
// If number is above max amount, correct it

0 commit comments

Comments
 (0)