I've been looking all around (and I couldn't find) an answer for the following.
In Vue 2.x, you could use mixins for life-cycle hooks, i.e., for instance: I could create a Mixins.js with
export default {
created() {
console.log('test');
}
}
and then, in a component, do the following:
import mixins from "../misc/mixins";
export default {
name: "My component",
mixins: [mixins],
created() {
console.log('Another test');
}
}
And if I ran "My component", I would get in the console both "Another test" and "test". I cannot find the way of doing something similar with the Composition API (of course, I can execute inside "onMounted" a functions that I imported from another file, but that's not that elegant).
Is there a way?
Thanks!