【发布时间】:2021-03-22 02:25:29
【问题描述】:
我正在使用反应 js。基本上,我在输入字段的右侧有一个带有递增和递减按钮的输入字段。当我增加该字段时,小数点右侧的数字会增加,而不是左侧的数字。不知道如何做到这一点,因为似乎其他人没有问这个问题。或者行为很奇怪。请参阅下面的代码和图像。谢谢!
输入组件:
<FormLabel component="legend" style={{ marginBottom: '8px' }}>
Hide Balances Below
</FormLabel>
<FormControl>
<Input
name="amount"
type="number"
inputProps={{ step: 'any' }}
value={dustThreshold}
onChange={e => setDustThreshold(e.target.value)}
endAdornment={
<InputAdornment position="end">
{ellipsize('BTC', this.ELLIPSE_LENGTH)}
</InputAdornment>
}
className={classes.input}
disableUnderline
/>
</FormControl>
基本上试图让右侧的值(.00001666)递增和递减,而不是“30”所在的位置(小数点左侧)
【问题讨论】:
-
这不是反应问题,您只需要添加带有特定小数位的步骤。
step=".00000001" -
谢谢!做到了!
标签: javascript reactjs react-native numbers decimal