【发布时间】:2020-02-17 06:20:45
【问题描述】:
使用带有反应的 Bootstrap 4.3.1 目前,我有这个
comments: {
elementLabel: "Comments",
elementType: 'textarea',
elementConfig: {
placeholder: '',
name: "comments",
id: "comments",
rows: 4
},
value: '',
form_value: "",
validation: {
},
valid: false,
touched: false,
isChanged: false,
errorMessage: "",
className: "form-control",
changed: (event) => this.inputChangedHandler(event, "comments"),
blured: (event) => this.inputBlurHandler(event, "comments")
},
尝试在 commnets 中使用上述更改,但没有帮助
<div className="form-row mb-3">
<div className="col-md-12">
<Input
{...this.state.comments}
/> </div>
</div>
这也是我的input 组件的情况,其中textarea 正在渲染。
case ('textarea'):
inputElement = (
<React.Fragment>
<label>{ReactHtmlParser(props.elementLabel)}</label>
<textarea
{...props.elementConfig}
className={inputClass}
value={props.value}
onChange={props.changed}
onBlur={props.blured}
/>
{
invalidClass || props.allowed_characters
?
<div className="form-row">
<div className={`col-md-10 text-left`}>
{invalidClass ? <span className="invalid-feedback">{props.errorMessage}</span> : null}
</div>
<div className="col-md-2 text-right">
{
props.allowed_characters ?
<span className="allowed_characters">{props.current_character_count} / {props.allowed_characters}</span>
: null
}
</div>
</div>
:
null
}
</React.Fragment>
)
尝试通过外部 scss 但没有帮助,现在该怎么办?
【问题讨论】:
标签: javascript css reactjs sass bootstrap-4