一.使用 vue-cli 创建
官方文档:https://cli.vuejs.org/zh/guide/creating-a-project.html#vue-create
## 查看@vue/cli版本,确保@vue/cli版本在4.5.0以上
vue --version
## 安装或者升级你的@vue/cli
npm install -g @vue/cli
## 创建
vue create vue_test
## 启动
cd vue_test
npm run serve
1.确认脚手架是否正确,创建vue项目
(此处会出现选择vue版本的问题,这里选择vue3,其他的都按回车即可)
2.启动
注意:这里是npm run serve,不是server
3.运行成功
4.初次使用,经常报错处的措施
①error:Component name ’ ”School" should always be multi - word vue/ multi -word- component names
它的意思是:组件名称“School”应始终为多单词 vue/多单词组件名称
解决方法:在我们的vue.config.js文件中添加一句
lintOnSave:false /*关闭语法检查*/
②error:You may use special comments to disable some warnings. Use // eslint-disable-next-line to ignor
"lint": "eslint --fix --ext .js,.vue src"
二.使用 vite 创建
官方文档:https://v3.cn.vuejs.org/guide/installation.html#vite
vite官网:https://vitejs.cn
![](https://cn.vitejs.dev/assets/esm.3070012d.png)
## 创建工程
npm init vite-app <project-name>
## 进入工程目录
cd <project-name>
## 安装依赖
npm install
## 运行
npm run dev
1.创建