现在官方推荐使用 create-vue 来创建基于 Vite 的新项目→ 快速上手 | Vue.js
1、安装VueCLi vue.js 开发工具 网站: Vue CLI 去官网看教程
cmd 运行命令 安装
npm install -g @vue/cli 或者 cnpm install -g @vue/cli 下载速度快一点 等待安装即可;
查看安装版本 vue -V ---> @vue/cli 5.0.8
2、创建项目 vue create vue-demo (项目名不能有大写)
操作: 选择:上 下键,选中:空格键,回车确认 下一步操作
? Please pick a preset: 选 > Manually select features
Default ([Vue 3] babel, eslint)
Default ([Vue 2] babel, eslint)
> Manually select features
Vue CLI v5.0.8 选 >(*) Babel 和 (*) Progressive Web App (PWA) Support
? Please pick a preset: Manually select features
? Check the features needed for your project: (Press
>(*) Babel
( ) TypeScript
(*) Progressive Web App (PWA) Support
( ) Router
( ) Vuex
( ) CSS Pre-processors
( ) Linter / Formatter
( ) Unit Testing
( ) E2E Testing
----
Vue CLI v5.0.8 选 > 3.x
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, PWA
? Choose a version of Vue.js that you want to start the project with (Use arrow keys)
> 3.x
2.x
----
Vue CLI v5.0.8 选 > In dedicated config files
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, PWA
? Choose a version of Vue.js that you want to start the project with 3.x
? Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)
> In dedicated config files
In package.json
----
Vue CLI v5.0.8 选 n 是否保存为默认行为
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, PWA
? Choose a version of Vue.js that you want to start the project with 3.x
? Where do you prefer placing config for Babel, ESLint, etc.? In dedicated config files
? Save this as a preset for future projects? (y/N) n
----等待项目创建完成
Successfully created project vue-demo.
Get started with the following commands:
$ cd vue-demo
$ npm run serve
3、运行项目
1、 cd 到 文件目录 vue-demo
2、 运行 npm run serve
App running at: 运行成功
- Local: http://localhost:8080/
- Network: http://192.168.1.4:8080/
Note that the development build is not optimized.
To create a production build, run npm run build.
3、停止运行 CtrL +C y