• antd pro form 数组套数组 form数组动态赋值 shouldUpdate 使用


    antd form中数组套数组

    form数组动态变化 动态赋值
    在这里插入图片描述

    需求如上,同时添加多个产品,同时每个产品可以增加多台设备,根据设备增加相应编号,所以存在数组套数组,根据数组值动态变化
    使用的知识点

    1. form.list form中的数组展示
    2. shouldUpdate 根据form值来动态变化
    3. 数组是引用类型
    // An highlighted block
    <div >
                <Form
                   form={form}
                   name="basic"
                   labelCol={{
                       flex: '90px',
                       }}
                   initialValues={{
                       productList:[{
                           bianHao:'',
                           wuMiao:'',
                           number:1,
                           tType:'you',
                           files:{},
                           list:[{
                               sheBei:'',
                               guZi:'',
                               ziYou:'',
                           }],
                           }]
                   }}
                   labelWrap={true}
                   labelAlign="left"
                   onFinish={onFinish}
                   onFinishFailed={onFinishFailed}
                   autoComplete="off"
                   >
                   {/*