File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1919 <div class =" btn" @click =" append('3')" >3</div >
2020 <div class =" btn operator" @click =" plus" >+</div >
2121 <div class =" btn zero" @click =" append('0')" >0</div >
22- <div class =" btn" >.</div >
22+ <div class =" btn" @click = " dot " >.</div >
2323 <div class =" btn operator" @click =" equal" >=</div >
2424 </div >
2525 </div >
@@ -83,8 +83,8 @@ export default {
8383 },
8484 equal () {
8585 this .current = ` ${ this .operator (
86- parseInt (this .current ),
87- parseInt (this .previous )
86+ parseFloat (this .current ),
87+ parseFloat (this .previous )
8888 )} ` ;
8989 this .operator = null ;
9090 this .operatorClicked = false ;
@@ -100,6 +100,11 @@ export default {
100100 divide () {
101101 this .operator = (a , b ) => a / b;
102102 this .setPrevious ();
103+ },
104+ dot () {
105+ if (this .current .indexOf (" ." ) === - 1 ) {
106+ this .append (" ." );
107+ }
103108 }
104109 }
105110};
You can’t perform that action at this time.
0 commit comments