Vue + TypeScript 重构 vue-admin-element 小结
栏目: JavaScript · 发布时间: 7年前
内容简介:简单看了下
简单看了下 typescript 官网 的语法,就想借助一个项目实战下。这里选用了 vue-admin-element
附上源码地址: vue-element-admin-ts ,欢迎 star 或 fork
遇到的问题及解决方案
-
Q: error TS7017: Index signature of object type implicitly has an 'any' type
A: https://stackoverflow.com/que...
或者在
tsconfig.json文件的compilerOptions选项中添加"noImplicitAny": false
-
Q: error TS2339: Property 'webkitURL' does not exist on type 'Window'
A: https://stackoverflow.com/que...
interface Window { webkitURL?: any; } declare var window: Window; -
Q: Property 'context' does not exist on type 'NodeRequire'.
A: https://github.com/rails/webp...
npm i -D @types/webpack-env
- Q: 'this' implicitly has type 'any' because it does not have a type annotation
-
Q: 导入 .vue 时,为什么会报错,即使所写的路径并没有问题?
A: 在 TypeScript 中,它仅识别 js/ts/jsx/tsx 文件,为了让它识别 .vue 文件,我们需要显式告诉 TypeScript,vue 文件存在,并且指定导出 VueConstructor:
declare module '*.vue' { import Vue from 'vue' export default Vue } -
Q: TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
A: 空的数组添加数据的时候,会有这个提示,解决方案: https://github.com/Microsoft/...
-
Q: Property 'basePath' has no initializer and is not definitely assigned in the constructor.
59 | @Prop({required: true, default: {}}) public item: Route; 60 | @Prop({default: false}) public isNest: boolean; > 61 | @Prop({default: ''}) public basePath: string; - A: https://github.com/kaorun343/...
- Q: Object is possibly 'undefined'.
-
Q: Property '$refs' does not exist on type 'Element | Element[] | Vue | Vue[]'. Property '$refs' does not exist on type 'Element'.
A: https://github.com/vuejs/vue-...
以上所述就是小编给大家介绍的《Vue + TypeScript 重构 vue-admin-element 小结》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
菜鸟侦探挑战数据分析
[日] 石田基广 / 支鹏浩 / 人民邮电出版社 / 2017-1 / 42
本书以小说的形式展开,讲述了主人公俵太从大学文科专业毕业后进入征信所,从零开始学习数据分析的故事。书中以主人公就职的征信所所在的商业街为舞台,选取贴近生活的案例,将平均值、t检验、卡方检验、相关、回归分析、文本挖掘以及时间序列分析等数据分析的基础知识融入到了生动有趣的侦探故事中,讲解由浅入深、寓教于乐,没有深奥的理论和晦涩的术语,同时提供了大量实际数据,使用免费自由软件RStudio引领读者进一步......一起来看看 《菜鸟侦探挑战数据分析》 这本书的介绍吧!