DEV Community

Discussion on: Getting Started with Vue.js Plugins [Production-Ready Example]

Collapse
 
lcarbonaro profile image
Les Carbonaro

Hi. I have a question about Vue plug-ins and I was wondering if anyone here can help.

I have a bunch of methods that I use across the whole application, from various components. First of all, is this a good use-case for plug-ins?

I currently have a number of such plug-ins in my project, and sometimes I use the same function name across plug-ins. (As I mentioned, these plug-ins hold common functions that are used throughout the application.)

So for example, I have a find() method in my Customers.js plug-in and a totally different find() method in my Products.js plug-in.

My question is: is there a way to namespace each plug-in such that I can do something like this in the same component:

Vue.Customers.find();
Vue.Products.find();

Thanks.

Collapse
 
lcarbonaro profile image
Les Carbonaro

A reply to my own question here