Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Created Jan 13, 2021
Embed
What would you like to do?
import Vue from "vue"
Vue.prototype.$events = new Vue
new Vue({})
export default {
name: "cmp1",
mounted() {
this.$events.$emit("cmp1Loaded")
}
}
export default {
name: "cmp2",
mounted() {
this.$events.$once("cmp1Loaded", () => {
console.log("cm1 component has been loaded!")
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment