我有2条路径,FlowService
可以管理这2条路径。
这是打字稿界面:
export interface FlowInterface {
//First effect
goToResultPreview: () => void
//Second effect
goToResult: () => void
}
这是第一个服务:
import {FlowInterface} from "./FlowInterface";
class CreditabilityFlow implements FlowInterface{
goToResultPreview: () => void = ()=> {
console.log('CreditabilityFlow - goToResultPreview')
}
goToResult: () => void = () => {
console.log('CreditabilityFlow - goToResult')
}
}
export default new CreditabilityFlow()
这是第二项服务:
class InstallmentFlow implements FlowInterface{
goToResultPreview: () => void = ()=> {
console.log('InstallmentFlow - goToResultPreview')
}
goToResult: () => void = () => {
console.log('InstallmentFlow - goToResult')
}
}
两者都实现相同的接口。所以现在我也有2个用JavaScript编写的.vue
组件。是否可以导入可以导入的FlowService
之类的东西,并在InstallmentFlow
返回的第一视图集CreditabilityFlow
或FlowService
中的某处?