0👍
If those dialogs are in different components, eventBus maybe the best way to communicate between non-parent-child components:
- in "main.js":
new Vue({ data: { eventHub: new Vue() }, ... }).$mount("#app")
- in your dialog component, or the component that contain the dialog:
created() { this.$root.eventHub.$on("close-dialog", () => { do something to close your dialog, such as this.visible = false }) }
- before open your new dialog:
this.$root.eventHub.$emit("close-dialog")
- [Vuejs]-Vue-cli-service@latest' is not in the npm registry on Windows. Works in WSL
- [Vuejs]-Vue – Handle non English characters in an attribute
Source:stackexchange.com