自学内容网 自学内容网

Property ‘$router‘ does not exist on type TS2339

问题:Property 'XXX' does not exist on type '.... 

启动VUE项目的时候,VUE文件没有报错,但是npm run serve之后,项目报错。

参考网上的写法, 用this['router'] 可以解决此问题,没尝试过。

但是项目里太多地方使用this.写法,改起来太多了。

参考网友经验,在tsconfig.json 里面的compilerOptions下配置"noImplicitThis": false 可以解决Property '$router' does not exist on type 这种问题。

可以参考:前端 - Property '$router' does not exist on type - SegmentFault 思否


原文地址:https://blog.csdn.net/xypds2010/article/details/140726092

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!