Skip to content

Instantly share code, notes, and snippets.

@getJv
Created July 11, 2020 22:16
Show Gist options
  • Save getJv/25ca0db2d558180fdd09fec9dbbce6d3 to your computer and use it in GitHub Desktop.
Save getJv/25ca0db2d558180fdd09fec9dbbce6d3 to your computer and use it in GitHub Desktop.
const customMethods = {
install(Vue) {
// INSTALL
if (this.installed) return;
this.installed = true;
Vue.options = Vue.util.mergeOptions(Vue.options, {
created: function() {
if (this.$options.customMethod) {
// If found in the component.
this.$options.customMethod(); // Execute the customMethod.
}
},
});
},
};
export default customMethods;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment