2017-08-24 80 views
3

目前我正在試圖將其設置爲這樣的TextField組件的自定義數據屬性:材料UI文本字段自定義屬性

class TestTextField extends React.Component { 
componentDidMount() {console.log(this._input)} 
    render() { 
    return (
     <TextField 
     label="Label 1" 
     InputProps={{placeholder: 'Input 1', 'data-state': 'Data State 1'}} 
     margin="normal" 
     inputRef={(elem) => {this._input = elem}} 
     /> 
    ) 
    } 
} 

但是我不能讓data-state與控制檯日誌說

露面
<textarea rows="1" class="MuiTextarea-textarea-67 MuiInput-input-56 MuiInput-inputMultiline-64" placeholder="Input 1" type="text"> 

TextField不支持自定義屬性嗎?我正在使用v1.0.0-beta.6(https://material-ui-1dab0.firebaseapp.com/api/text-field/

回答