vue 3项目的创建
-
安装脚手架
npm install -g @vue/cli //建议使用--这个会在电脑的全局安装命令 # OR yarn global add @vue/cli
-
通过脚手架快速创建项目
vue3test git:(master) ✗ vue create vue3-1 ### 默认的镜像源下载会很慢 ? Your connection to the default yarn registry seems to be slow. //默认的镜像源下载会很慢 ### 是否切换到淘宝镜像源 Use https://registry.npm.taobao.org for faster installation? (Y/n) y ### 请选择预置 ? Please pick a preset: (Use arrow keys) ❯ Default ([Vue 2] babel, eslint) //使用vue2.X的模版 Default (Vue 3 Preview) ([Vue 3] babel, eslint) //使用vue3.0 的模版 Manually select features //自定义模版---建议选择则 ### 检查你的项目需要的功能: ? Check the features needed for your project: ❯◉ Choose Vue version //选择Vue版本 ◉ Babel //兼容浏览器--将es6转成es5 ◉ TypeScript //使用Ts ◯ Progressive Web App (PWA) Support //PWA。谷歌提出的桌面应用 ◉ Router //路由 ◉ Vuex //状态管理器 ◯ CSS Pre-processors //css预处理 ◉ Linter / Formatter //代码风格格式化 ◯ Unit Testing //单元测试 ◯ E2E Testing //端对端测试 ### 选择一下vue的版本 ? Choose a version of Vue.js that you want to start the project with (Use arrow keys) ❯ 2.x 3.x (Preview) ### 是否使用class风格的组件语法 ?Use class-style component syntax? No ### 是否使用babel做转义 ? Use Babel alongside TypeScript (required for modern mode, auto-detected polyfills, transpiling JSX)? No ### 是否选择用历史的模式来做路由 ? Use history mode for router? (Requires proper server setup for index fallback in production) Yes ### 选择Linter / Formatter规范类型 ? Pick a linter / formatter config: Basic ### 保存时检查/提交时检查 ? Pick additional lint features: Lint on save ### 你更喜欢将Babel, ESLint等的配置放在哪里? ? Where do you prefer placing config for Babel, ESLint, etc.? In dedicated config files ### 是否需要保存为模版 ? Save this as a preset for future projects? No ### 使用什么进行下载 ? Pick the package manager to use when installing dependencies: Yarn