mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: 修复单测问题
This commit is contained in:
parent
024efd3a17
commit
7ace846fa7
@ -61,7 +61,7 @@ export default class TimelineItemControl extends React.Component<
|
||||
if (source === this.state.source) {
|
||||
return;
|
||||
}
|
||||
this.setState({source: source, api: '', items: []}, this.onChange);
|
||||
this.setState({source, api: '', items: []}, this.onChange);
|
||||
}
|
||||
|
||||
@autobind
|
||||
|
@ -1,3 +1,7 @@
|
||||
.#{$ns}Timeline {
|
||||
min-height: #{px2rem(10px)};
|
||||
}
|
||||
|
||||
.#{$ns}Timeline-vertical {
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
|
@ -305,9 +305,6 @@ export function withRemoteConfig<P = any>(
|
||||
ignoreData: true
|
||||
}).url) &&
|
||||
this.loadConfig();
|
||||
} else if (!source) {
|
||||
//如果source为空,则清空配置
|
||||
this.setConfig(undefined);
|
||||
}
|
||||
|
||||
if (data !== prevProps.data) {
|
||||
|
@ -199,7 +199,7 @@ const TimelineWithRemoteConfig = withRemoteConfig({
|
||||
RemoteOptionsProps & React.ComponentProps<typeof TimelineCmpt>
|
||||
> {
|
||||
render() {
|
||||
const {config, items, deferLoad, loading, updateConfig, ...rest} =
|
||||
const {config, items, deferLoad, loading, updateConfig, source, ...rest} =
|
||||
this.props;
|
||||
|
||||
let sourceItems: Array<TimelineItemSchema> = config
|
||||
@ -210,6 +210,11 @@ const TimelineWithRemoteConfig = withRemoteConfig({
|
||||
title: config[key]
|
||||
}))
|
||||
: items || [];
|
||||
|
||||
// 如果items有值或者source为空,则直接使用items
|
||||
if (items?.length || !source) {
|
||||
sourceItems = items || [];
|
||||
}
|
||||
return <TimelineCmpt items={sourceItems} {...rest} />;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user