Build a vue3.0 project from 0 to 1

1. Build the project with vue scaffolding

Step 1: Install node.js

  • Download and install node.js of the corresponding system from the official website, and install it after downloading
    insert image description here
  • After the installation is complete, open the cmd command execution window and execute node -v and npm -v to see if node.js is installed successfully. If the version number appears, it proves that the installation is successful, as shown in the figure below:
    insert image description here

Step 2: Install vue

  • Open cmd, execute the npm install -g @vue/cli command (install vue3.0), and wait for the command to complete:
    insert image description here
  • Execute vue -V to see if vue is installed successfully. If the version number appears, it proves that the installation is successful, as shown below:
    insert image description here

Step 3: Create a vue project using vue scaffolding

  • Go to the folder of the vue project (you can create it yourself), and enter the folder, open cmd

  • Execute the vue create demo command, where demo is your project name; in the process of creating a project, you will be asked to choose whether to create a vue2.0 or vue3.0 project. According to my needs, I choose vue3.0, as shown in the figure below, after selection Wait for the creation to complete
    insert image description here

  • Enter the demo project file, execute the npm install command in cmd, and install the relevant dependency packages

Step 4: After creating the project, run the vue project

  • In the demo folder, run npm run serve to start the project just created

insert image description here

2. Build the project with vite

Step 1: Install node.js

(same as step 1 above)

Step 2: Build a project with vite

  • Go to the folder of the vue project (you can create it yourself), and enter the folder, open cmd
  • Execute the npm init vite-app vite_demo command, where vite_demo is your project name; wait for the command to complete
  • Enter the vite_demo project file, execute the npm install command in cmd, and install the relevant dependency packages

Step 3: After creating the project, run the project

  • In the vite_demo folder, run npm run dev to start the project just created
    insert image description here

3. The difference between vite and vue-cli

  • Vite is a web development build tool that enables lightning-fast cold server startup thanks to its native ES module imports
  • vue-cli is an official vue.js project scaffolding, use vue-cli to quickly create vue projects
    insert image description here

4. Other matters

The development software can choose vscode

insert image description here

Guess you like

Origin blog.csdn.net/bradyM/article/details/126875535