# AssembleList (选项列表)
# 使用范围
ui、行为、规则组件通用
# 使用方式
- 简易版
config:{
carousels: {
type: 'AssembleList',
text: '轮播图 配置',
minCount: 1, // 最小个数
maxCount: 6,// 最大个数
itemTitle: '配置Item',
fields: { // fields下的属性的展现形式,也通过设置type来确定
src: {
type: 'FilePicker',
controlParams: {
type: 'Image'
},
text: '图片'
},
link: {
type: 'NormalText',
text: '跳转链接'
}
}
}
}
- 高阶版
config:{
pageDetailImg: {
text: '尾部素材图配置',
type: 'AssembleList',
minCount: 0,
maxCount: 100,
require: true,
noDragSort: false,
itemTitle: '尾部配置素材',
fields: {
type: {
text: '尾部素材类型',
type: 'RadioButton',
require: true,
options: [
{ text: '图片', value: '1' },
{ text: '视频', value: '2' }
]
},
img: {
type: 'FilePicker',
controlParams: {
type: 'Image'
},
text: '素材图',
require: true,
when(config, index) { // 注意:AssembleList中的when函数返回的参数为config 不为widget
return (config.pageDetailImg[index] && config.pageDetailImg[index]['type'] == '1');
}
},
videoPoster: {
type: 'FilePicker',
controlParams: {
type: 'Image'
},
text: '视频封面图',
require: true,
when(config, index) {
return (config.pageDetailImg[index] && config.pageDetailImg[index]['type'] == '2');
}
},
videoSrc: {
type: 'NormalText',
text: '视频链接',
require: true,
when(config, index) {
return (config.pageDetailImg[index] && config.pageDetailImg[index]['type'] == '2');
}
}
}
}
}
- 参数
| 参数 | 说明 | 类型 | 可选值 | 默认值 | 是否必填 |
|---|---|---|---|---|---|
| minCount | 最小个数 | number | * | - | 否 |
| maxCount | 最大个数 | number | * | - | 否 |
| itemTitle | 配置item标题 | string | * | - | 是 |
| noDragSort | 不可移动 | boolean | true/false | true | 否 |
| fields | controls object(NormalText等所有controls) | object | * | - | 是 |
# 效果
