diff --git a/src/guide/extras/web-components.md b/src/guide/extras/web-components.md index 22aa1cb85b..3bd6872a8b 100644 --- a/src/guide/extras/web-components.md +++ b/src/guide/extras/web-components.md @@ -183,6 +183,20 @@ defineCustomElement(MyComponent, { }) ``` +To use a [Vue plugin](/guide/reusability/plugins) in a custom element, install it on the element's app instance inside `configureApp`: + +```js +import MyPlugin from './my-plugin' + +defineCustomElement(MyComponent, { + configureApp(app) { + app.use(MyPlugin) + } +}) +``` + +Each custom element instance has its own Vue app, so plugins must be installed through `configureApp` for each instance that needs them. + ### SFC as Custom Element {#sfc-as-custom-element} `defineCustomElement` also works with Vue Single-File Components (SFCs). However, with the default tooling setup, the `