Skip to content

Commit 4478325

Browse files
committed
feature #444 Add Vue app to the vue:mount event (pierredup)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- Add Vue app to the vue:mount event | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Tickets | N/A | License | MIT Add the Vue app to the `vue:mount` event, so that users can have access to it when hooking into the event in order to use [Vue Plugins](https://vuejs.org/guide/reusability/plugins.html#introduction) with components. Without access to the app instance, it's not possible to use plugins. Commits ------- 86fa0c8 Add Vue app to the vue:mount event
2 parents 733cc8b + 86fa0c8 commit 4478325

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Vue/Resources/assets/src/render_controller.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ export default class extends Controller<Element & { __vue_app__?: App<Element> }
3535
if (this.element.__vue_app__ !== undefined) {
3636
this.element.__vue_app__.unmount();
3737
}
38+
39+
this._dispatchEvent('vue:before-mount', {
40+
componentName: this.componentValue,
41+
component: component,
42+
props: this.props,
43+
app: this.app,
44+
});
3845

3946
this.app.mount(this.element);
4047

0 commit comments

Comments
 (0)