Parameters: the rule is the plugin (Object | | Function)

What it does: Plug-ins that install vue.js must pass in an object or function. If it is an object, the object must provide an Install method. If it is a function, this function is called install.

Its internal mechanism determines that the same plug-in will only be installed once,

The vue.use source code can be viewed on gitHub, located

vue/src/core/global-api/use.jsCopy the code

Under the directory



InstalledPlugins = installedPlugins = installedPlugins = installedPlugins = installedPlugins

If the previous plug-in has been installed, it will be found, and the current execution will not continue, directly return,



As the code continues, it converts all the arguments to an array and puts vUE first.



If an object is passed in, install is executed, as is a function. Then place the plug-in in the array declared initially




That’s all the source code for Vue. use on Github.