@fast-china/utils
Version:
Fast 工具库.
32 lines (31 loc) • 673 B
JavaScript
const NOOP = () => {
};
const withInstall = (main, extra) => {
main.install = (app) => {
for (const comp of [main, ...Object.values(extra ?? {})]) {
app.component(comp.name, comp);
}
};
if (extra) {
for (const [key, comp] of Object.entries(extra)) {
main[key] = comp;
}
}
return main;
};
const withNoopInstall = (component) => {
component.install = NOOP;
return component;
};
const withInstallDirective = (directive, name) => {
directive.install = (app) => {
app.directive(name, directive);
};
return directive;
};
export {
withInstall,
withInstallDirective,
withNoopInstall
};
//# sourceMappingURL=install.mjs.map