<TextField type="number" min="0" max="10" step="1" />
λ Typescriptλ‘ μ»΄νμΌν΄μΌν©λλ€.
μ΅μμ λν΄ λ€μ Typescript μ€λ₯λ₯Ό μμ ν©λλ€. μ΅λ λ° λ¨κ³μ μ μ¬ν©λλ€. [ts] Property 'min' does not exist on type 'IntrinsicAttributes & TextFieldProps & { children?: ReactNode; }'.
| κΈ°μ | λ²μ |
| -------------- | --------- |
| Material-UI | 1.0.0- λ² ν .21 |
| λ°μ | 16.0.0 |
| νμ΄ν μ€ν¬λ¦½νΈ | 2.6.1 |
μλν©λκΉ?
<TextField type="number" inputProps={{ min: "0", max: "10", step: "1" }} />
λ€, μλν©λλ€. inputProps
λ μ΄λ€ κ²μ΄ λ ν¬ν¨ λ κ°μ²΄λ₯Ό νμ©νλ―λ‘μ΄ λ°©λ²μΌλ‘ μ ν μμ€ν
μ ν¨κ³Όμ μΌλ‘ μ΅νΈ μμν©λλ€.
λ€, μλν©λλ€.
inputProps
λ μ΄λ€ κ²μ΄ λ ν¬ν¨ λ κ°μ²΄λ₯Ό νμ©νλ―λ‘μ΄ λ°©λ²μΌλ‘ μ ν μμ€ν μ ν¨κ³Όμ μΌλ‘ μ΅νΈ μμν©λλ€.
μ’μ μ§μ μ
λλ€. inputProps
μ
λ ₯μ μμ νκΈ° μν΄ # 9321μ μ΄μμ΅λλ€.
inputProps
λ InputComponent
μμ _anything goes_λ₯Ό νμ©νκΈ°μν κ²μ
λλ€. μ΄λ₯Ό ν΅ν΄ μνκΉκ²λ μ νμ μμ§ λͺ»νκ±°λ κ°μ§ μμλ μΈλΆ κ΅¬μ± μμμμ κ°λ°©ν ν΅ν©μ΄ κ°λ₯ν©λλ€.
μ:
import * as MaskedInput from 'react-text-mask'
<TextField
InputProps={{
inputComponent: MaskedInput,
}}
inputProps={{
guide: false,
mask,
placeholderChar: '\u2000',
}}
type="tel"
value={value}
/>
λ°λΌμ λμΌν μλ리μ€μμ κ°λ ₯ν μ νμ inputProps
(@ pelotomμκ² κ°μ¬)λ₯Ό νΌνλ λμμ λ€μκ³Ό κ°μ΅λλ€.
import { InputProps as MuiInputProps } from 'material-ui/Input'
<TextField
InputProps={{
inputComponent: (inputProps: MuiInputProps) => (
<MaskedInput {...inputProps} guide={false} mask={mask} placeholderChar="\u2000" />
),
}}
type="tel"
value={value}
/>
@pelotom μμ΄ APIλ₯Ό λ€μ λ°©λ¬ΈνκΈ° μν΄ μλ‘μ΄ μ μ / λ¬Έμ λ₯Ό μ μΆνκ³ μμ΅λλ€.
λΏ‘λΏ‘
MaskedInputμ΄ μ μλμ§ μμμ΅λλ€.
λ§μ€ν¬κ° μ μλμ§ μμμ΅λλ€.
:(
μ΄κ²μ μ§λμΉκ² 볡μ‘ν ν΄κ²° λ°©λ² μΈ κ² κ°μ΅λλ€.
λͺ¨λ κ³³μμ λ°λ³΅λλ λ Όλ¦¬μμ΄ μ ν¨μ± κ²μ¬λ₯Ό μν ν μ μλλ‘ TextField μμ€μμ μ μνλ κ²μ΄ μ’μ΅λλ€. μ΅μ / μ΅λ / λ¨κ³ μꡬ μ¬νμ΄μλ μ«μ νλμ μ¬μ©ν λλ§λ€ TextFieldλ₯Ό νμ₯ν΄μΌνλ κ²μ μ«μ΄ν©λλ€.
κ°μ₯ μ μ©ν λκΈ
μλν©λκΉ?