vue3 ts项目或者非ts项目创建(区别就是一个选项)

4 篇文章 0 订阅
vue3 学习备注

需要安装vscode 目前HBuilder对代码检测无能

vue3 的创建
vue --version 查看vue版本 要4.5.3以上
如果不是需要卸载原版本安装最新版本 如果是vue-cli 2.x 卸载命令: npm uninstall -g vue-cli
安装vue-cli 高版本 不能用cnpm 要用npm 命令:  npm install -g @vue/cli

创建 vue 命令 vue create 项目名 

创建选项 可以默认 如果不默认 各项选择及说明如下:
Your connection to the default npm registry seems to be slow.
   Use https://registry.npm.taobao.org for faster installation? (Y/n)  Y  这个就是链接淘宝的npm


Vue CLI v4.5.8
? Please pick a preset: (Use arrow keys)
  Default ([Vue 2] babel, eslint)  这个是创建 vue2 
  Default (Vue 3 Preview) ([Vue 3] babel, eslint) 这个是默认创建 vue 3
> Manually select features 这个是自定义创建  选这个


Vue CLI v4.5.8
? Please pick a preset: Manually select features
? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert selection)
> (*) Choose Vue version  这个是版本选择 因为我们要创建vue3 项目 所以选上
> (*) Babel
> (*) TypeScript 选择ts
 ( ) Progressive Web App (PWA) Support
>(*) Router  需要路由
>(*) Vuex  需要公共参数
>(*) CSS Pre-processors  CSS处理器 如果用sass这个选上
 ( ) Linter / Formatter  代码效验如果不用就不要选了
 ( ) Unit Testing
 ( ) E2E Testing


 Use class-style component syntax? (y/N) 是否使用类样式组件vue2常用 vue3不用了 所以是n
 Use Babel alongside TypeScript (required for modern mode, auto-detected polyfills, transpiling JSX)? (Y/n) 这里我们也不用Babel配合ts 所以也是n
 Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) 这里我们需要不带#的路由 也就是history模式 所以这里是y
 
 
  Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): (Use arrow keys)
 > Sass/SCSS (with dart-sass) 这里选dart-sass 速度快 功能新
   Sass/SCSS (with node-sass)
   Less
   Stylus
   
   Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)
   > In dedicated config files  生成独立的配置文件
     In package.json
	 
Save this as a preset for future projects? (y/N) 配置要不要保存以后使用 这个我选n 你可以依据自己需求选择

上面选完就开始创建了 这里把所有选择总览放上
Vue CLI v4.5.8
? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, TS, Router, Vuex, CSS Pre-processors
? Choose a version of Vue.js that you want to start the project with 3.x (Preview)
? Use class-style component syntax? No
? 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
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): Sass/SCSS (with dart-sass)
? Where do you prefer placing config for Babel, ESLint, etc.? In dedicated config files
? Save this as a preset for future projects? No
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值