Answer the question
In order to leave comments, you need to log in
How to call a global method created as a plugin?
let MyPlugin = {};
MyPlugin.install = function (Vue) {
Vue.myGlobalMethod = function () {
alert(999)
}
};
Vue.use(MyPlugin);
Answer the question
In order to leave comments, you need to log in
To be able to call like this, the method must be placed in the prototype: Vue.prototype.myGlobalMethod = ...
.
Looks like you need Global Mixins
https://ru.vuejs.org/v2/guide/mixins.html#%D0%93%D...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question