push
This commit is contained in:
27
lib/component/form/field-registry.ts
Normal file
27
lib/component/form/field-registry.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { Component } from 'vue';
|
||||
|
||||
class FieldRegistry {
|
||||
private static readonly _instance: FieldRegistry = new FieldRegistry();
|
||||
private readonly _map: Map<string, Component>;
|
||||
constructor() {
|
||||
this._map = new Map<string, Component>();
|
||||
}
|
||||
|
||||
push(compName: string, component: Component) {
|
||||
this._map.set(compName, component);
|
||||
}
|
||||
|
||||
static get instance() {
|
||||
return this._instance;
|
||||
}
|
||||
|
||||
get(compName: string) {
|
||||
return this._map.get(compName);
|
||||
}
|
||||
|
||||
get map() {
|
||||
return this._map;
|
||||
}
|
||||
}
|
||||
const fieldRegistry = FieldRegistry.instance;
|
||||
export { fieldRegistry };
|
||||
Reference in New Issue
Block a user