mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:48:55 +08:00
each 组件空状态时文字居左,同时将空数组状态也认为是空状态 (#1988)
Co-authored-by: cy <chenyi08@kuaishou.com>
This commit is contained in:
parent
f36738587c
commit
3ad95846b9
@ -69,7 +69,7 @@ order: 45
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"each": ["A3", "B3", "C3"]
|
||||
"each": []
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -83,6 +83,7 @@ order: 45
|
||||
"name": "each",
|
||||
"label": "循环",
|
||||
"type": "each",
|
||||
"placeholder": "暂无内容",
|
||||
"items": {
|
||||
"type": "tpl",
|
||||
"tpl": "<span class='label label-info m-l-sm'><%= this.item %></span>"
|
||||
@ -118,9 +119,10 @@ List 的内容、Card 卡片的内容配置同上
|
||||
|
||||
## 属性表
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 说明 |
|
||||
| ------ | -------- | -------- | ------------------------------------------------------------------- |
|
||||
| type | `string` | `"each"` | 指定为 Each 组件 |
|
||||
| value | `array` | `[]` | 用于循环的值 |
|
||||
| name | `string` | | 获取数据域中变量,支持 [数据映射](../../docs/concepts/data-mapping) |
|
||||
| items | `object` | | 使用`value`中的数据,循环输出渲染器。 |
|
||||
| 属性名 | 类型 | 默认值 | 说明 |
|
||||
| ----------- | -------- | -------- | ------------------------------------------------------------------- |
|
||||
| type | `string` | `"each"` | 指定为 Each 组件 |
|
||||
| value | `array` | `[]` | 用于循环的值 |
|
||||
| name | `string` | | 获取数据域中变量,支持 [数据映射](../../docs/concepts/data-mapping) |
|
||||
| items | `object` | | 使用`value`中的数据,循环输出渲染器。 |
|
||||
| placeholder | `string` | | 当 `value` 值不存在或为空数组时的占位文本 |
|
||||
|
@ -1,7 +1,7 @@
|
||||
.#{$ns}Each {
|
||||
&-placeholder {
|
||||
color: var(--text--muted-color);
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
padding: var(--gap-sm);
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ export default class Each extends React.Component<EachProps> {
|
||||
|
||||
return (
|
||||
<div className={cx('Each', className)}>
|
||||
{Array.isArray(arr) && items ? (
|
||||
{Array.isArray(arr) && arr.length && items ? (
|
||||
arr.map((item: any, index: number) =>
|
||||
render(`item/${index}`, items, {
|
||||
data: createObject(
|
||||
|
Loading…
Reference in New Issue
Block a user