@inkline/paper
Version:
Paper is a unified interface for defining components for Vue and React using a single code base.
16 lines (15 loc) • 534 B
JavaScript
export const definePlugin = (setup) => ({
install(app, options) {
for (const componentIndex in options?.components) {
if (options.components[componentIndex].name) {
app.component(options.components[componentIndex].name, options.components[componentIndex]);
}
}
setup(options, {
provide: (identifier, data) => {
app.config.globalProperties[`$${typeof identifier === "symbol" ? identifier.description : identifier}`] = data;
app.provide(identifier, data);
}
});
}
});