alibaba / alibaba/x-render

嵌套列表里层依赖外层 dependValues 拿不到最新

Open
#1,587 0 comments 0 reactions 1 assignee Claimed by @lhbxs View on GitHub
Dominant language
TypeScript
Stars
7.9k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

嵌套列表里层依(第二项及之后)赖外层 dependValues 拿不到最新

image

```ts
import React, { useState, useEffect, useMemo } from 'react';
import FormRender, { useForm } from 'form-render';
import { Input } from 'antd';

const MyInput = React.memo((props: any) => {
console.log('props =========>', props);
const disabled = props.addons.dependValues?.[0] === 'xxx';
return (

)
})

const schema = {
type: 'object',
maxWidth: 400,
properties: {
input1: {
title: '输入框 1',
type: 'string',
},
list: {
title: 'List 嵌套',
type: 'array',
widget: 'cardList',
items: {
type: 'object',
title: 'List.Item',
properties: {
input4: {
title: '输入框 4',
type: 'string',
},

list: {
type: 'array',
widget: 'cardList',
items: {
type: 'object',
title: '二级 List.Item',
properties: {
delongInput2: {
title: '输入框input6测试联动的校验(依赖 input4)',
type: 'string',
props: {
placeholder: '当 input4 value 为 "xxx" 的时候 disabled 掉',
},
dependencies: ['list[].input4'],
widget: 'MyInput',
},
},
},
},
},
},
},
},
};

export default () => {
const form = useForm();
const watch = {};

return (

);
};
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.