-
-
Save cursosdesarrolloweb/bcf4ce7e1d905ffad38e4dda345109cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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