vue3【1. Build the project】

vue3

Upgrade vue-cli

Global upgrade sudo npm i -g @vue/cli, pay attention to permissions.

View version vue -V

Use vue-cli to build a project

usevue create 项目名
Insert picture description here

Then select the preset, here you can choose the version of vue, choose vue3.

vite build tool

After vue3 appeared, vite also appeared, and its startup project was faster than vue-cli. vue-cli uses webpack.

use

  1. Use npm to temporarily download vite-app, then use vite-app to build the vue3-app-vite project, and finally delete vite-app. The advantage of this is that the version of vite-app used each time is the latest, and there is no need to install it globally.

    npm init vite-app vue3-app-vite

  2. Enter the project directory, npm i,start the project npm run dev, open the browser, and the following interface will appear.

Insert picture description here

注意:

  1. The .vue file is quoted in the vue3 project built with vite, and the suffix name must be written, otherwise it cannot be recognized, and the .js need not be written.
  2. index.html is placed under the project root directory, not under public.

Guess you like

Origin blog.csdn.net/tscn1/article/details/114716996