vue3.0 vue/cil4.0搭建

VUE3.0 搭建

更新Vue CLI

//卸载
npm uninstall -g vue-cli
//安装 目前版本4.5.4
npm install -g @vue/cli

创建应用

vue create vue3.0

选项

Default ([Vue 2] babel, eslint)                    //vue2版本默认
Default (Vue 3 Preview) ([Vue 3] babel, eslint)          //vue3版本默认 
Manually select features                       //选择自定义创建
 ◉ Choose Vue version                                //选择版本
 ◉ Babel                                             //Babel
 ◯ TypeScript                                        //ts使用
 ◯ Progressive Web App (PWA) Support             //创建为web应用
 ◯ Router                                            //创建Router
 ◯ Vuex                                              //创建vuex
 ◯ CSS Pre-processors                                //使用css预处理器
 ◉ Linter / Formatter                                //选择规范类型
 ◯ Unit Testing                                      //选择Unit测试方式
 ◯ E2E Testing                                       //选择E2E测试方式
//我这个只选择了TS VUEX CSS ROUTER
//版本选择 3.x
  • Use class-style component syntax? 是否使用class-style? 这个我其他文章有介绍
  • Use Babel alongside TypeScript (required for modern mode, auto-detected polyfills, transpiling JSX)? 是否使用JSX格式?   如果有需要就使用,我就不用了
  • Use history mode for router? 对路由器使用历史记录模式么? 官方文档有描述history模式,我仅做练习,不使用。
  • CSS预处理我选择Less,这个看个人。
  • 然后是几种ES检查模式,我选择ESLint with error prevention only。
? Pick additional lint features: (Press <space> to select, <a> to toggle all, <i
> to invert selection)
 ◉ Lint on save              //保存就检测
❯◯ Lint and fix on commit       //fix和commit的时候检测  

目录结构

原文地址:https://www.cnblogs.com/lrqcx/p/13608195.html