Home >Web Front-end >Vue.js >What is vue.use

What is vue.use

藏色散人
藏色散人Original
2021-02-05 09:38:375581browse

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)" .

What is vue.use

#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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn