Vue Cli
Vue CLI = Vue + a bunch of js plugins
1. The full name of cli is Command-Line Interface, which is translated as command line interface, commonly known as scaffolding
2. Vue Cli is the scaffolding of a project released on the official website
3. Using vue-cli can help us quickly build the Vue development environment and corresponding webpack configuration
How to use
Vue CLI is a scaffolding, which is a code generator in layman's terms. It can quickly generate a complete front-end framework based on Vue, compile and deploy separately. Various third-party plug-ins can be integrated to expand more functions.
Vue is an asymptotic framework that you can use as a function or use a family bucket. For example, you can introduce it in the old jsp or thymeleaf project and use its core data binding function only.
If the project is too simple, it is just some basic data rendering, and there is no need to use Vue Cli scaffolding. When developing large-scale projects, you need to consider trivial matters such as code directory structure, project structure, deployment and hot updates. You can leave these things to the scaffolding for configuration.
About the Vue Cli version introduction
The old version is named vue-cli, and the new version is @vue/cli.
If you have already installed an older version of vue-cli (or), you need to uninstall it first via npm uninstall vue-cli -g or yarn global remove vue-cli .
npm uninstall vue-cli -g or yarn global remove vue-cli
@vue/cli Install
Note: Vue Cli requires version 8.9 or higher (8.11.0+ recommended).
You can use nvm or nvm-windows to manage multiple Node versions in the same computer.
- npm install -g @vue/cli (the latest version is installed)
- npm install [email protected] (Specify version installation [Specify version is below 3.0], where 2.9.6 is the version number)
- npm install -g @vue/[email protected] (Specify version installation [Specify version is 3.0 or above], where 3.11.0 is the version number)
Query the version number of available packages via the command line:
npm view vue-cli versions --json (3.0The following versions) npm view @vue/cli versions --json (3.0The above version)
Vue/cli version view:
vue -V
Version number corresponds to
- Vue CLI below 4.5, corresponding to Vue2
- Vue CLI 4.5 and above, corresponding to Vue3
- However, when using vue init to create a project, you will have the opportunity to choose Vue2
View vue and @vue/cli versions
vue -V and vue --version are the versions of vue-cli (scaffolding).
C:\Users\Mavis>vue -V @vue/cli 5.0.8
To view the vue version, use the following command:
npm list vue || npm list vue -g
Notice:
Vue and scaffolding templates are completely different from Vue.
Summarize
The above is personal experience. I hope you can give you a reference and I hope you can support me more.