使用Material-UI表单组件呈现的值不同于表单值

时间:2018-08-15 00:33:36

标签: reactjs material-ui redux-form

我有一个基于Material-UI的TextField组件的自定义组件(用于redux-form)。

如何使它呈现的值不同于实际值?

再说一次,如果该值为负,则将其呈现为Math.abs(num),但其实际值仍为负吗?

export const renderModTextField = ({input, label, meta: { touched, error }, ...custom}) => (
    <TextField
        error={touched && error}
        {...input}
        {...custom}
        InputProps={{
            startAdornment: <InputAdornment position="start">{input.value >= 0 ? "+" : "-"}</InputAdornment>,
        }}
    />
);

0 个答案:

没有答案