从Material-UI的TextField中删除默认的mm/dd/yyyy日期格式,可以通过以下几种方法实现:
import TextField from '@material-ui/core/TextField';
<TextField
label="Date"
type="date"
InputLabelProps={{
shrink: true,
}}
InputProps={{
placeholder: '',
}}
/>
import TextField from '@material-ui/core/TextField';
import InputAdornment from '@material-ui/core/InputAdornment';
<TextField
label="Date"
type="date"
InputLabelProps={{
shrink: true,
}}
InputProps={{
endAdornment: <InputAdornment position="end"></InputAdornment>,
}}
/>
import TextField from '@material-ui/core/TextField';
import { withStyles } from '@material-ui/core/styles';
const CustomTextField = withStyles({
root: {
'& .MuiInputBase-input[type="date"]::-webkit-calendar-picker-indicator': {
display: 'none',
},
},
})(TextField);
<CustomTextField
label="Date"
type="date"
InputLabelProps={{
shrink: true,
}}
/>
以上是几种常用的方法来从Material-UI的TextField中删除默认的mm/dd/yyyy日期格式。根据具体需求和项目情况,可以选择适合的方法进行实现。
领取专属 10元无门槛券
手把手带您无忧上云