What is Vue.use()
Last Updated: November 3, 2021
You can use Vue.use()
global method to install (or call the plug-in) which you develop in your application. (or you can use to call the NPM install plugin)
For example, if you have a plugin developed in your existing application called DataLoader, you can use the following code to load that to your Vue instance
Vue.use(DataLoader)
So , Your DataLoader will be loaded for your application
Vue.use(plugin)
Arguments of the use() can be object or function
If the plugin is an Object, it must expose an install method. This method has to be called before calling new Vue()
You can see the sample code here.
// calls `MyPlugin.install(Vue)` Vue.use(MyPlugin) new Vue({ //... options })
If you are interested in developing Vue plugins, read our post about how to develop Vue plugin