基于属性文件中设置的某些属性if(prop1 = false)然后如何在FlowBuilder中删除流processingFlow1 ..
import React, { Fragment, forwardRef, useRef } from "react";
import "../styles.css";
const Hero = forwardRef((props, ref) => {
return (
<section ref={ref}>
<h1>Hero Section</h1>
</section>
);
});
const About = forwardRef((props, ref) => {
return (
<section ref={ref}>
<h1>About Section</h1>
</section>
);
});
const Contact = forwardRef((props, ref) => {
return (
<section ref={ref}>
<h1>Contact Section</h1>
</section>
);
});
function Home({ innerRefs }) {
return (
<Fragment>
<Hero ref={innerRefs.heroRef} />
<About ref={innerRefs.aboutRef} />
<Contact ref={innerRefs.contactRef} />
</Fragment>
);
}
export default Home;
新流程
Flow processingFlow1 = new FlowBuilder<Flow>("ProcessingFlow1").start(ProcessingFlow1Step).build();
Flow processingFlow2 = new FlowBuilder<Flow>("ProcessingFlow2").start(ProcessingFlow2Step).build();
;
向流构建器添加流
Flow rulesFlow = new FlowBuilder<Flow>("rulesFlow").build()
我的问题基于属性文件中设置的某些属性
rulesFlow = new FlowBuilder<Flow>("rulesFlow").split(new SimpleAsyncTaskExecutor())
.add(ProcessingFlow1, ProcessingFlow2, ProcessingFlow3, )
.build();
然后如何在FlowBuilder中删除流程processingFlow1。
if(prop1=false)
答案 0 :(得分:0)
您可以将构建器提取为变量,并根据您的条件动态添加流,例如:
Flow processingFlow1 = ...
Flow processingFlow2 = ...
Flow processingFlow3 = ...
FlowBuilder.SplitBuilder<Flow> rulesFlowBuilder = new FlowBuilder<Flow>("rulesFlow")
.split(new SimpleAsyncTaskExecutor());
if (shouldAddFlow()) { // check prop1=false in this method
rulesFlowBuilder.add(processingFlow1);
}
Flow rulesflow = rulesFlowBuilder.add(processingFlow2, processingFlow3).build();