【问题标题】:Input field read-only using React-redux-form使用 React-redux-form 只读输入字段
【发布时间】:2018-02-16 23:05:37
【问题描述】:

在创建可写输入字段时遇到问题。

import { Control } from "react-redux-form";
import { FormControl } from "react-bootstrap";

const existingItem = {
    name: "John",
    city: "Oakland",
};

<Control
    component={FormControl}
    model=".defaultItem"
    componentClass="input"
    id="original-item"
    value={existingItem.name}
/>

我的目标是显示一个包含现有Item.name 的输入字段,以便我可以编辑和提交。

但是使用value 属性,输入字段变为只读。通常我为此使用defaultValue,但在这种情况下defaultValue 呈现输入字段可写但为空。

【问题讨论】:

  • 你的商店里有.defaultItem吗?
  • 哇原来只是.item 而不是.defaultItem 谢谢

标签: javascript node.js twitter-bootstrap reactjs express


【解决方案1】:

.defaultItem 很可能在您的商店中不存在。

【讨论】:

    猜你喜欢
    • 2023-03-18
    • 2021-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多