Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Created January 13, 2021 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cursosdesarrolloweb/bcf4ce7e1d905ffad38e4dda345109cc to your computer and use it in GitHub Desktop.
Save cursosdesarrolloweb/bcf4ce7e1d905ffad38e4dda345109cc to your computer and use it in GitHub Desktop.
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