-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
What problem does this feature solve?
在json schema中,不能通过rections写法,动态依赖index获取items中的数据更改card的标题。
!!场景,我需要根据items的内容动态渲染标题!!
在arraycard的使用过程中,依赖于index的items中某项表单的数据动态获取标题。首先标题只能在array层级传入, items层级没办法通过对title的设置修改卡片标题;其次,在array层级没法获取到每个items的indext导致不能动态props进!!
const schema = {
type: 'object',
properties: {
string_array: {
type: 'array',
'x-component': 'ArrayCards',
maxItems: 3,
'x-decorator': 'FormItem',
'x-component-props': {
title: '字符串数组',
},
items: {
type: 'void',
properties: {
index: {
type: 'void',
'x-component': 'ArrayCards.Index',
},
input: {
type: 'string',
'x-decorator': 'FormItem',
title: 'Input',
required: true,
'x-component': 'Input',
},
remove: {
type: 'void',
'x-component': 'ArrayCards.Remove',
},
moveUp: {
type: 'void',
'x-component': 'ArrayCards.MoveUp',
},
moveDown: {
type: 'void',
'x-component': 'ArrayCards.MoveDown',
},
},
},
properties: {
addition: {
type: 'void',
title: '添加条目',
'x-component': 'ArrayCards.Addition',
},
},
},
What does the proposed API look like?
希望能解决标题不能根据item中的内容动态渲染
可以解决的的三种api
1、在item中可以对title进行设置
2、提供ArrayCards.Title渲染标题
3、在Array层级可以获取items的索引