typescript创建vue项目

本文介绍了如何创建一个Vue项目并集成TypeScript。首先确保安装了Node.js,然后通过npm全局安装TypeScript和@vue/cli。安装完成后,可以检查TypeScript版本并利用@vue/cli初始化Vue项目。
摘要由CSDN通过智能技术生成

安装typescript

先将node安装,然后在通过npm安装ts的包

npm install -g typescript

tsc -v 查看ts的版本号

第一步【下载最新版本@vue/cli】

npm i -g @vue/cli

Microsoft Windows [版本 10.0.18362.1082]
(c) 2019 Microsoft Corporation。保留所有权利。

C:\Users\Lenovo\Desktop\1910-高级程序设计\项目>vue create ts-vue


Vue CLI v4.5.6
? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, TS, Router, Vuex
? Choose a version of Vue.js that you want to start the project with 2.x
? 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
? Where do you prefer placing config for Babel, ESLint, etc.? In dedicated config files
? Save this as a preset for future projects? No


Vue CLI v4.5.6
✨  Creating project in C:\Users\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue.
�  Initializing git repository...
⚙️  Installing CLI plugins. This might take a while...


> yorkie@2.0.0 install C:\Users\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue\node_modules\yorkie
> node bin/install.js

setting up Git hooks
done


> ejs@2.7.4 postinstall C:\Users\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue\node_modules\ejs
> node ./postinstall.js

added 1139 packages from 899 contributors in 35.49s

47 packages are looking for funding
  run `npm fund` for details

�  Invoking generators...
�  Installing additional dependencies...

added 6 packages from 2 contributors in 5.591s

47 packages are looking for funding
  run `npm fund` for details

⚓  Running completion hooks...

�  Generating README.md...

�  Successfully created project ts-vue.
�  Get started with the following commands:

 $ cd ts-vue
 $ npm run serve


C:\Users\Lenovo\Desktop\1910-高级程序设计\项目>cd ts-vue

C:\Users\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue>npm run serve

> ts-vue@0.1.0 serve C:\Users\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue
> vue-cli-service serve

 INFO  Starting development server...
Starting type checking service...
Using 1 worker with 2048MB memory limit
10% building 0/1 modules 1 active ...Desktop\1910-高级程序设计\项目\ts-vue\node_modules\webpack\hot\dev-server.js ./src/10% building 2/4 modules 2 active C:\Users\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue\node_modules\webpack\hot\dev-ser10% building 2/5 modules 3 active ...ader\index.js??ref--12-1!C:\Users\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue\src\10% building 3/5 modules 2 active ...ader\index.js??ref--12-1!C:\Users\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue\src\10% building 4/5 modules 1 active ...ader\index.js??ref--12-1!C:\Users\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue\src\10% building 4/6 modules 2 active ...sktop\1910-高级程序设计\项目\ts-vue\node_modules\webpack\hot sync nonrecursive /^\.10% building 5/6 modules 1 active ...ader\index.js??ref--12-1!C:\Users\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue\src\40% building 6/8 modules 2 active ...\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue\node_modules\webpack\hot\log-apply-re40% building 6/9 modules 3 active C:\Users\Lenovo\Desktop\1910-高级程序设计\项目\ts-vue\node_modules\webpack\hot\emitter40% building 6/10 modules 4 active ...o\Desktop\1910-高级程序设计\项目\ts-vue\node_modules\webpack-dev-server\client\ove40% building 6/11 modules 5 active ...vo\Desktop\1910-高级程序设计\项目\ts-vue\node_modules\webpack-dev-server\client\so40% building 6/12 modules 6 active ...Desktop\1910-高级程序设计\项目\ts-vue\node_modules\webpack-dev-server\client\u
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值