OSDN Git Service

fixed the unit swtich bug.
authorZhiting Lin <zlin035@uottawa.ca>
Tue, 31 Jul 2018 03:19:39 +0000 (11:19 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Tue, 31 Jul 2018 03:19:39 +0000 (11:19 +0800)
src/features/shared/components/AmountInputMask/AmountInputMask.jsx
src/utility/buildInOutDisplay.js

index ab37680..51fd6a7 100644 (file)
@@ -36,7 +36,7 @@ class AmountInputMask extends React.Component {
   }
 
   componentDidUpdate(prevProps){
-    if(prevProps.decimal !== this.props.decimal){
+    if(prevProps.decimal !== this.props.decimal && prevProps.fieldProps.value){
       const value = (prevProps.fieldProps.value/ Math.pow(10, prevProps.decimal)).toString()
 
       this.props.fieldProps.onChange(
index 2033003..c445c8d 100644 (file)
@@ -157,7 +157,7 @@ const addZeroToDecimalPos = (src,pos) => {
 }
 
 const formatIntNumToPosDecimal = (neu,pos) => {
-  if(neu != null ){
+  if(neu != null && neu !== ''){
     let neuString = neu.toString()
     let neuLength = neuString.length
     if(neuLength <= pos){