About the installation of vue 3.X, 2.x and the use of ElementUI

## 4.1: Basic usage of scaffolding

Vue scaffolding is used to quickly generate Vue project infrastructure
npm install -g @vue/cli

1: Create a new version of the vue project based on the interactive command line

vue create my-project // Do not Chinese, special symbols

2: Create a new version of the vue project based on the graphical interface

ui view

3: Create an old vue project based on the old template of 2.X

npm install -g @vue/cli-init // 2.X version must install this
vue init webpack my-project

4.3 Custom configuration of Vue scaffolding

Configure the project through package.json [must conform to json syntax]
[This configuration method is not recommended, because package.json is mainly used to manage the configuration information of the package.
For the convenience of maintenance, it is recommended to define the vue scaffolding-related configuration separately to In the vue.config.js configuration file
]
"vue": { "devServer": { "port": "8080", "open": true } }




vue.config.js

module.exports = {
devServer: {
open: true,
port: 8888
}
}

5: Basic use of Element-UI

1: Manual installation based on command
①: Install dependent package: npm i element-ui -S
②: Import Element-UI related resources

//
Import ElementUI from'element-ui' in the entry file main.js // Import component library
import'element-ui/lib/theme-chalk/index.css' // Import related component style
Vue.use(ElementUI) // Configure the vue plugin

2: Automatic installation of Element-UI based on graphical interface
[VUE version 2.X has few problems with Element-UI installation, and it is easy to solve, other versions... try it yourself]
① Run the vue ui command and open Graphical interface
② Enter the specific project configuration panel through the Vue project manager
③ Click Plug-in --> Add Plug-in, enter the plug-in query panel
④ Search for vue-cli-plugin-element and install
⑤ Configure the plug-in, and implement on-demand import, Thereby reducing the volume of the packaged project

Guess you like

Origin blog.csdn.net/qq_38192709/article/details/114011989