确保电脑中安装了 node.js 服务端运行环境,node 版本查询终端输入 node -v 指令
一、配置 Vue3.0 开发环境
// 全局安装或升级
npm install -g @vue/cli
# OR
yarn global add @vue/cli
// 使用 vue 创建项目
vue create my-project
# OR
// 使用图形化界面创建项目
vue ui
项目创建步骤
- Please pick a preset -- 选择 Manually select features
- Check the features needed for your project -- 默认选项加上 TypeScript
注意:点空格是选择,点回车是进入下一步 - Choose a version of Vue.js that you want to start the project with -- 选择 3.x (Preview)
- Use class-style component syntax -- 输入 n,回车
- Use Babel alongside TypeScript -- 输入n,回车
- Pick a linter / formatter config -- 直接回车
- Pick additional lint features -- 直接回车
- Where do you prefer placing config for Babel, ESLint, etc.? -- 直接回车
- Save this as a preset for future projects? -- 输入n,回车
二、插件推荐
Eslint 插件
如果 eslint 不生效,在根目录创建 .vscode 文件夹,在文件夹中创建 settings.json 文件,输入以下内容
// settings.json
{
"eslint.validate": ["typescript"]
}