33 lines
706 B
JavaScript
33 lines
706 B
JavaScript
import { NOOP } from '@vue/shared';
|
|
|
|
const withInstall = (main, extra) => {
|
|
;
|
|
main.install = (app) => {
|
|
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
app.component(comp.name, comp);
|
|
}
|
|
};
|
|
if (extra) {
|
|
for (const [key, comp] of Object.entries(extra)) {
|
|
;
|
|
main[key] = comp;
|
|
}
|
|
}
|
|
return main;
|
|
};
|
|
const withInstallFunction = (fn, name) => {
|
|
;
|
|
fn.install = (app) => {
|
|
app.config.globalProperties[name] = fn;
|
|
};
|
|
return fn;
|
|
};
|
|
const withNoopInstall = (component) => {
|
|
;
|
|
component.install = NOOP;
|
|
return component;
|
|
};
|
|
|
|
export { withInstall, withInstallFunction, withNoopInstall };
|
|
//# sourceMappingURL=with-install.mjs.map
|