Home >Web Front-end >Vue.js >What is vue.use
vue.use is an official API provided to developers, used to register and install plug-ins such as Vuex, vue-router, and ElementUI. Its usage syntax is "Vue.use(plugin)" .
#The operating environment of this article: Windows7 system, vue2.0, Dell G3 computer.
Vue.use(plugin)
Vue.use is used to install plug-ins.
Usage:
Vue.use(plugin)
If the plug-in is an object, the install method must be provided.
If the plug-in is a function, it will be used as the install method. When the install method is called, Vue will be passed in as a parameter.
After Vue.use(plugin) is called, the plug-in's install method will accept a parameter by default, which is Vue (the principle part will be discussed)
This method needs to call new Vue () was called before.
When the install method is called multiple times by the same plug-in, the plug-in will only be installed once. (How to implement it will be analyzed during source code analysis)
Summary: Vue.use is an API officially provided to developers, used to register and install plug-ins such as Vuex, vue-router, and ElementUI.
The above is the detailed content of What is vue.use. For more information, please follow other related articles on the PHP Chinese website!