Khi tôi đang cố gắng đặt giá trị của một formControl bằng cách sử dụng phản ứng bootstrap, tôi gặp phải lỗi trong bảng điều khiển.
Nội dung chính Show
Kết xuất nhãn FormLabel dưới dạng thành phần <FormControl>4 (chấp nhận tất cả các đạo cụ giống nhau), cũng như thêm kiểu dáng bổ sung cho các hình thức ngang. Trực quan Thay đổi thành phần cơ bản CSS Base Class và công cụ sửa đổi tên lớp Tiền tố. Đây là một cửa thoát hiểm để làm việc với CSS Bootstrap tùy chỉnh nặng. Cung cấp các điều khiển biểu mẫu văn bản như S và S nâng cấp với các kiểu tùy chỉnh, kích thước, trạng thái lấy nét và nhiều hơn nữa. Đối với các hình thức văn bản, các điều khiển, giống như input và ____ 3s, sử dụng thành phần FormControl. FormControl bổ sung một số phong cách bổ sung cho ngoại hình chung, trạng thái tập trung, kích thước, và nhiều hơn nữa. Kích thước Kết xuất nhãn FormLabel dưới dạng thành phần <FormControl>4 (chấp nhận tất cả các đạo cụ giống nhau), cũng như thêm kiểu dáng bổ sung cho các hình thức ngang. invariant.js:44 Uncaught Error: Objects are not valid as a React child (found: [object HTMLTextAreaElement]). If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons. Check the render method of `FormGroup`.
FormControl không có phương thức cho giá trị, vì vậy không chắc chắn làm thế nào khác để thực hiện điều này. Đây là cách tôi đang cố gắng đặt giá trị.
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
htmlfor
sợi dây Sử dụng
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
6 từ <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
7 nếu không được chỉ định rõ ràng.Trực quan Ẩn nhãn trực quan trong khi vẫn cho phép nó được đọc bởi các công nghệ hỗ trợ.
BSPREFIX <FormControl>
8
Thay đổi thành phần cơ bản CSS Base Class và công cụ sửa đổi tên lớp Tiền tố. Đây là một cửa thoát hiểm để làm việc với CSS Bootstrap tùy chỉnh nặng. Kiểm soát hình thức
Cung cấp các điều khiển biểu mẫu văn bản như S và S nâng cấp với các kiểu tùy chỉnh, kích thước, trạng thái lấy nét và nhiều hơn nữa. Thí dụ
Kích thước API <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
0 Mã nhập khẩu cho thành phần biểu mẫuCopy import code for the Form component
Tên Loại hình Mặc định Sự mô tả Tham khảo Phản ứng
Mẫu
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
1 sẽ được chuyển tiếp đến phần tử cơ bản, có nghĩa là, trừ khi nó được hiển thị <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
2 thành phần tổng hợp, nó sẽ là một nút DOM, khi được giải quyết.
như loại nguyên tố
size
5Bạn có thể sử dụng loại phần tử tùy chỉnh cho thành phần này.
xác nhận boolean
Đánh dấu một biểu mẫu như đã được xác nhận. Đặt nó thành size
6 sẽ chuyển bất kỳ kiểu xác thực nào trên các phần tử biểu mẫu.
FormLabel <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
1 sẽ được chuyển tiếp đến phần tử cơ bản. Trừ khi FormLabel được hiển thị <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
2 thành phần tổng hợp, nó sẽ là một nút DOM, khi được giải quyết. <FormControl>
0
Đặt phần tử tùy chỉnh cho thành phần này
Tôi sợi dây
Sử dụng
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
6 từ <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
7 nếu không được chỉ định rõ ràng.
không có hiệu lực boolean
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
8Thêm các kiểu xác thực "không hợp lệ" vào nhãn điều khiển và đi kèm
isvalid boolean
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
8Thêm các kiểu xác thực "không hợp lệ" vào nhãn điều khiển và đi kèm
isvalid function
Thêm các kiểu xác thực "hợp lệ" vào điều khiển
onchange boolean
Một cuộc gọi lại bị bắn khi input
0 thay đổi
văn bản thô boolean
Kết xuất đầu vào dưới dạng văn bản đơn giản. Thường được sử dụng dọc theo readOnly
.
chỉ đọc Làm cho điều khiển một cách đọc được | input
3
kích thước
input
2 | input
3sợi dây
Biến thể kích thước đầu vào
loại hình Đầu vào HTML input
4, chỉ có liên quan nếu
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
2 là <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
3 (mặc định).
giá trị
Chuỗi | Arrayof | con số
Được kiểm soát bởi: input
7, prop ban đầu: input
8 sợi dây
Thuộc tính input
0 của đầu vào cơ bản BSPREFIXThis is an escape hatch for working with heavily customized bootstrap css.
htmlfor
sợi dây Sử dụng
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
6 từ <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
7 nếu không được chỉ định rõ ràng.Trực quan
Ẩn nhãn trực quan trong khi vẫn cho phép nó được đọc bởi các công nghệ hỗ trợ.
BSPREFIX <FormControl>
8
Thay đổi thành phần cơ bản CSS Base Class và công cụ sửa đổi tên lớp Tiền tố. Đây là một cửa thoát hiểm để làm việc với CSS Bootstrap tùy chỉnh nặng.
Các hình thức
Ví dụ và hướng dẫn sử dụng cho các kiểu điều khiển biểu mẫu, tùy chọn bố cục và các thành phần tùy chỉnh để tạo ra nhiều hình thức khác nhau.
API <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
0 Mã nhập khẩu cho thành phần biểu mẫuCopy import code for the Form component
Tên Loại hình Mặc định Sự mô tả Tham khảo Phản ứng
Mẫu
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
1 sẽ được chuyển tiếp đến phần tử cơ bản, có nghĩa là, trừ khi nó được hiển thị <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
2 thành phần tổng hợp, nó sẽ là một nút DOM, khi được giải quyết.
như loại nguyên tố
size
5Bạn có thể sử dụng loại phần tử tùy chỉnh cho thành phần này.
xác nhận boolean
Đánh dấu một biểu mẫu như đã được xác nhận. Đặt nó thành size
6 sẽ chuyển bất kỳ kiểu xác thực nào trên các phần tử biểu mẫu.
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
0 Mã nhập khẩu cho thành phần biểu mẫuCopy import code for the Form component
Tên Loại hình Mặc định Sự mô tả Tham khảo Phản ứng
Mẫu
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
1 sẽ được chuyển tiếp đến phần tử cơ bản, có nghĩa là, trừ khi nó được hiển thị <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
2 thành phần tổng hợp, nó sẽ là một nút DOM, khi được giải quyết.
như loại nguyên tố
size
5Bạn có thể sử dụng loại phần tử tùy chỉnh cho thành phần này.
xác nhận Đánh dấu một biểu mẫu như đã được xác nhận. Đặt nó thành size
6 sẽ chuyển bất kỳ kiểu xác thực nào trên các phần tử biểu mẫu.input
2 | input
3
FormLabel <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
1 sẽ được chuyển tiếp đến phần tử cơ bản. Trừ khi FormLabel được hiển thị <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
2 thành phần tổng hợp, nó sẽ là một nút DOM, khi được giải quyết. <FormControl>
0
Đặt phần tử tùy chỉnh cho thành phần này cột
Boolean | input
2 | input
3
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
8boolean
FormLabel <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
1 sẽ được chuyển tiếp đến phần tử cơ bản. Trừ khi FormLabel được hiển thị <FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
2 thành phần tổng hợp, nó sẽ là một nút DOM, khi được giải quyết. <FormControl>
0
Đặt phần tử tùy chỉnh cho thành phần này cột
Boolean | input
2 | input
3
<FormGroup controlId="parameterDescription">
<ControlLabel>Description</ControlLabel>
<FormControl componentClass="textarea" placeholder="Description of parameter function" inputRef={(ref) => {this.state.description = ref}} readOnly={true}>
{this.state.description}
</FormControl>
</FormGroup>
8This is an escape hatch for working with heavily customized bootstrap css.