params' default value
This commit is contained in:
parent
403ea01769
commit
1520ecfcf6
|
@ -16,6 +16,7 @@ const initialState = {
|
|||
}
|
||||
|
||||
export default function appReducer(state = initialState, action) {
|
||||
console.log(state.paramValue)
|
||||
switch (action.type) {
|
||||
case actionTypes.GENERATE_QR_INFO: {
|
||||
let text = action.text;
|
||||
|
@ -53,7 +54,13 @@ export default function appReducer(state = initialState, action) {
|
|||
}
|
||||
|
||||
const newItem = item.slice();
|
||||
newItem[action.paramIndex] = isNaN(action.value) ? action.value : parseInt(action.value);
|
||||
let newValue = action.value;
|
||||
if (newValue.length <= 0)
|
||||
newValue = state.paramInfo[action.rendererIndex][action.paramIndex].default;
|
||||
console.log(newValue)
|
||||
|
||||
if (!isNaN(newValue)) newValue = parseInt(newValue);
|
||||
newItem[action.paramIndex] = newValue;
|
||||
return newItem;
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue