amis-saas-6518 [Bug] 测试:【组件优化第五批】时间轴-数据-接口获取,通过输入框、API中心、高级配置的API,配置后无法获取数据;

Change-Id: If39046a5e2f2a83ec9ebd2b7f4c3433853466007
This commit is contained in:
liqiu03 2022-10-27 15:13:21 +08:00
parent b0d31df615
commit b07c7ad24b
2 changed files with 8 additions and 2 deletions

View File

@ -20,8 +20,9 @@ export class TimelinePlugin extends BasePlugin {
label: '时间轴', label: '时间轴',
name: 'timeline', name: 'timeline',
items: [ items: [
{time: '2012-12-21', title: '节点数据'}, {time: '2012-12-21', title: '节点示例数据'},
{time: '2012-12-24', title: '节点数据'} {time: '2012-12-24', title: '节点示例数据'},
{time: '2012-12-27', title: '节点示例数据'}
] ]
}; };
previewSchema = { previewSchema = {

View File

@ -77,6 +77,9 @@ export default class TimelineItemControl extends React.Component<
data.items = items.map(item => ({...item})); data.items = items.map(item => ({...item}));
} }
if (source === 'api') { if (source === 'api') {
const {items, api} = this.state;
data.items = items.map(item => ({...item}));
data.source = api;
} }
onBulkChange && onBulkChange(data); onBulkChange && onBulkChange(data);
} }
@ -396,6 +399,7 @@ export default class TimelineItemControl extends React.Component<
renderOption(props: TimelineItem & {index: number}) { renderOption(props: TimelineItem & {index: number}) {
const {time, title, index} = props; const {time, title, index} = props;
const delDisabled = !(this.state.items.length > 2);
return ( return (
<li className="ae-TimelineItemControlItem" key={index}> <li className="ae-TimelineItemControlItem" key={index}>
<div className="ae-TimelineItemControlItem-Main"> <div className="ae-TimelineItemControlItem-Main">
@ -472,6 +476,7 @@ export default class TimelineItemControl extends React.Component<
type: 'button', type: 'button',
className: 'ae-TimelineItemControlItem-action', className: 'ae-TimelineItemControlItem-action',
label: '删除', label: '删除',
disabled: delDisabled,
onClick: () => this.toggleDelete(index) onClick: () => this.toggleDelete(index)
} }
] ]