I am looking for a way to automatically run a specific function as a beforeMount
hook in every component of my Vue project without having to declare it individually. Essentially, I want a default behavior where if the hook is not explicitly stated in a component, it will execute a fallback action like printing 'Default hook'. Is there an option or setting that I can use when creating a new Vue instance to achieve this?
If it's not possible to have this default behavior, is there a way to replace all instances of the beforeMount
hooks with a single function throughout the project?
UPD.
From what I understand, global mixins are always executed. However, I do not want them to run if the same hook is declared within a component. Instead, I need the default hook function to be used only when no specific hook is defined.