Open
Description
Is your feature request related to a problem? Please describe.
When creating addons that introduces other component libraries, some will require a context provider to enable the full capability of the libraries. e.g. to provide themes. Currently, seems like we only have control on the app
object, (can do app.use()
, etc), but we don't have access to the definition of the app itself.
Describe the solution you'd like
Give a config function for wrapping global context provider:
import { h, type Component } from "vue";
export function defineGlobalProvider(
wrapper: (appRoot: Component) => Component
) {
return (appRoot: Component) => wrapper(appRoot);
}
This should be put in createApp()
And the configuration will look like:
// main.ts
defineGlobalProvider((rootComponent) => ({
render() {
return h(MyGlobalProvider, null, () => h(rootComponent));
},
}));
See also in: