背景:
因为公司要做服务器渲染配置的TS有点很坑的,故此记录一下
项目初始化
可以根据官网的安装步骤选择自己用的依赖进行安装,[详情请看][1],主要详细的说下nuxt如何配置typescript
在工程目录中创建tsconfig.json,如果有不清楚可以参照下图
安装 vue-property-decorator 、ts-vue-plugin、 ts-loader、typescript –save
需要注意的是如果使用的是vscode, – >首选项 – >设置 添加:”javascript.implicitProjectConfig.experimentalDecorators”: true,可以避免一些【Experimental decorators warning in TypeScript compilation】错误。
如果你在引入成功的时候,但是vscode还是报错找不到模块等,那么请在tsconfig.json方面找一下,相信可以解决你的问题。
参考的资料:https://zh.nuxtjs.org/example… https://nuxtjs.org/guide/type…https://github.com/wagerfield…https://github.com/nuxt/docs/…https://ts.xcatliu.com/basics…https://github.com/nuxt-commu…https://dev.to/nuxt/nuxtjs-v2…https://codesandbox.io/s/0qmy…https://github.com/TypeStrong…https://stackoverflow.com/que…https://segmentfault.com/a/11…https://blog.csdn.net/fabulou…https://www.tslang.cn/docs/ha…https://github.com/Microsoft/…https://github.com/Herrington…https://shelter.lancercomet.c…https://stackoverflow.com/que…https://github.com/vuejs/vetu…
发表回复