reactjs-可以在输入字段上类型

发布于 2025-02-14 01:25:03 字数 871 浏览 0 评论 0原文

我在输入字段上的打字问题。我正在从事一个大型项目,该项目已经有其他输入字段,该项目在我写它们时正在工作。今天,我正在添加新领域,并注意到这一点旧字段不接受任何类型的输入。

我知道这是一个常见的问题,但是我的问题既没有价值也没有变更集。

这是我正在研究的新领域的一个例子。

<TextField 
    id="outlined-basic" 
    name="text-container-field"
    label="Texto" 
    variant="outlined" 
    value={this.state.customText} 
    onChange={this.onCustomTextChange.bind(this)}
/>

<input 
    type="text" 
    name="text-container" 
    value={this.state.customText} 
    onChange={this.onCustomTextChange.bind(this)} 
/>

和Onchange功能

onCustomTextChange = event => {
    this.setState({customText: event.target.value})
}

我写了带有MUI和本机输入的输入字段,只是为了检查MUI Textfield是否存在问题,但这都是相同的。

I'm having an issue with the typing on input fields.. i'm working on a big project, which already had other input fields, which were working at the time i wrote them.. today i was adding new fields and noticed that the old fields didn't accept any kind of input.

I know this a common question, but my problem is neither not having the value or the onChange set.

Here is a example of the new fields i was working on.

<TextField 
    id="outlined-basic" 
    name="text-container-field"
    label="Texto" 
    variant="outlined" 
    value={this.state.customText} 
    onChange={this.onCustomTextChange.bind(this)}
/>

<input 
    type="text" 
    name="text-container" 
    value={this.state.customText} 
    onChange={this.onCustomTextChange.bind(this)} 
/>

And the onChange function

onCustomTextChange = event => {
    this.setState({customText: event.target.value})
}

i wrote the input fields with both MUI and native input just to check if there was an issue with MUI TextField, but it's all the same.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文