vue3.0+创建项目

骑猪看日落 2023-01-10 05:25 214阅读 0赞

1、vue create test //test为项目名
使用淘宝镜像创建项目,选择是

  1. ? Your connection to the default npm registry seems to be slow.
  2. Use https://registry.npm.taobao.org for faster installation? Yes

2、提示选择一个preset(预设),有3个选项,这里选择第三个,自主选择一些配置项

  1. ? Please pick a preset: (Use arrow keys)
  2. Default ([Vue 2] babel, eslint)
  3. Default (Vue 3 Preview) ([Vue 3] babel, eslint)
  4. > Manually select features

3、根据自己需求,选择相应项:按空格键选中,再按一次则取消选中,a全选,i反选

  1. ? Please pick a preset: Manually select features
  2. ? Check the features needed for your project:
  3. (*) Choose Vue version//选择vue版本,2.0?3.0?
  4. (*) Babel//转码器,可以将ES6代码转为ES5代码,从而在现有环境执行
  5. ( ) TypeScript//TypeScript是一个JavaScript(后缀.js)的超集(后缀.ts)包含并扩展了 JavaScript 的语法,需要被编译输出为 JavaScript在浏览器运行,目前较少人再用
  6. ( ) Progressive Web App (PWA) Support//渐进式Web应用程序
  7. (*) Router//vue-router(vue路由)
  8. (*) Vuex//vuex(vue的状态管理模式)
  9. >(*) CSS Pre-processors//CSS 预处理器(如:less、sass)
  10. (*) Linter / Formatter//代码风格检查和格式化(如:ESlint)
  11. ( ) Unit Testing//单元测试(unit tests)
  12. ( ) E2E Testing//e2e(end to end) 测试

4、选择vue版本,这里选择3.0+
5、选择路由模式,是否用历史模式,这里选择否(发现ie浏览器history模式只支持10及以上),用hash模式
Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n)
6、 css预处理器,主要为css解决浏览器兼容、简化CSS代码 等问题,选择Less
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default):
Sass/SCSS (with dart-sass)
Sass/SCSS (with node-sass)

Less
Stylus

7、ESLint:提供一个插件化的javascript代码检测工具,ESLint + Prettier //使用较多
Pick a linter / formatter config:
ESLint with error prevention only
ESLint + Airbnb config
ESLint + Standard config

ESLint + Prettier

8、什么时候检测

(*) Lint on save
( ) Lint and fix on commit (requires Git)

9、如何存放配置
Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)
In dedicated config files//专用配置文件

In package.json//放到package.json中

10、是否将此保存为将来项目的预设?(是/否)
Save this as a preset for future projects? (y/N)

发表评论

表情:
评论列表 (有 0 条评论,214人围观)

还没有评论,来说两句吧...

相关阅读

    相关 vue项目创建

    在开始之前,我们说一下怎么创建一个vue项目,现在的vue版本是2.x,不过3.0的版本估计会在明年下半年发布吧。所以我们还是用2.x的方式来说明。 最简单的方式就是使用一款