我想限制用户输入负值。我正在使用分钟=“0”。这样我可以限制用户递减到0,即用户只能将值递减到0。但是他们可以输入“-”。在react js中如何防止。
https://codesandbox.io/s/react-input-example-forked-xnvxm?file=/src/index.js
<input
type="number"
min="0"
step="1"
onChange={this.handleChange}
className="w-100"
value= "1"
/>
Run Code Online (Sandbox Code Playgroud) 您好,我在我的项目中使用材质表,我想知道如何更改材质 ui 自动完成中选项的字体大小。谢谢
import React from 'react';
import TextField from '@material-ui/core/TextField';
import Autocomplete from '@material-ui/lab/Autocomplete';
export default function ComboBox() {
return (
<Autocomplete
id="combo-box-demo"
options={top100Films}
getOptionLabel={(option) => option.title}
style={{ width: 300 }}
renderInput={(params) => <TextField {...params} label="Combo box" variant="outlined" />}
/>
);
}
// Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top
const top100Films = [
{ title: 'The Shawshank Redemption', year: 1994 },
{ title: 'The Godfather', year: 1972 },
];
Run Code Online (Sandbox Code Playgroud) 我想更改 Material Ui Autocomplet 的占位符字体大小。有什么办法吗?
<Autocomplete
multiple
id="tags-outlined"
options={top100Films}
getOptionLabel={(option) => option.title}
defaultValue={[top100Films[13]]}
filterSelectedOptions
size="small"
renderInput={(params) => (
<TextField
{...params}
variant="outlined"
placeholder="Enter Transshipment Ports"
/>
)}
/>
Run Code Online (Sandbox Code Playgroud)