1
0
mirror of synced 2026-03-23 11:18:36 +08:00

feat(editor,data-source): 支持数据源方法配置执行时机

This commit is contained in:
roymondchen
2023-08-10 16:04:12 +08:00
parent e3b2594c57
commit 07c49bee4e
6 changed files with 216 additions and 167 deletions

View File

@@ -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', () => {