mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 22:20:27 +08:00
28 lines
498 B
TypeScript
28 lines
498 B
TypeScript
export const crudList: ClCrud.Ref[] = [];
|
|
|
|
export const emitter: Emitter = {
|
|
list: [],
|
|
init(events) {
|
|
for (const i in events) {
|
|
this.on(i, events[i]);
|
|
}
|
|
},
|
|
emit(name, data) {
|
|
this.list.forEach((e: EmitterItem) => {
|
|
const [_name] = e.name.split("-");
|
|
|
|
if (name == _name) {
|
|
e.callback(data, {
|
|
crudList,
|
|
refresh(params) {
|
|
crudList.forEach((c) => c.refresh(params));
|
|
}
|
|
});
|
|
}
|
|
});
|
|
},
|
|
on(name, callback) {
|
|
this.list.push({ name, callback });
|
|
}
|
|
};
|