一、需求

二、组件封装
BatchInputNumber.js
import React, {
PureComponent, Fragment } from 'react';
import moment from 'moment';
import {
Form, Row, Col, InputNumber, Icon, Button, message } from 'antd';
import styles from './index.less';
const FormItem = Form.Item;
const formItemLayout = {
labelCol: {
span: 3 },
wrapperCol: {
span: 21 },
};
// 日期段组件
@Form.create()
export default class extends PureComponent {
constructor(props) {
super(props);
this.state = {
};
}
//变化
onInputChange = (id, value) => {
const {
inputBar, dispatch, name, dispatchType } = this.props;
let newInputBar = inputBar.map(item => {
return item.id != id
? item
: {
...item,
inputValue: value
};
});
dispatch({
type

本文介绍了如何在React中封装一个用于批量管理输入框的BatchInputNumber组件,详细阐述了需求背景、组件实现过程以及在实际项目中的调用方法。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



