feat(editor,data-source): 支持数据源方法配置执行时机
This commit is contained in:
@@ -81,8 +81,24 @@ class DataSourceManager extends EventEmitter {
|
||||
|
||||
this.data[ds.id] = ds.data;
|
||||
|
||||
ds.getMethods().forEach((method) => {
|
||||
if (method.timing === 'beforeInit') {
|
||||
if (typeof method.content === 'function') {
|
||||
method.content({ params: {}, dataSource: ds });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ds.init().then(() => {
|
||||
this.data[ds.id] = ds.data;
|
||||
|
||||
ds.getMethods().forEach((method) => {
|
||||
if (method.timing === 'afterInit') {
|
||||
if (typeof method.content === 'function') {
|
||||
method.content({ params: {}, dataSource: ds });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ds.on('change', () => {
|
||||
|
||||
Reference in New Issue
Block a user