【Vue】VueCli3 + Vue + typescript 挖坑记

栏目: JavaScript · 发布时间: 5年前

内容简介:VueCli3.0生成Vue+ts的项目组件,中间遇到了一些让我直接放弃结合ts的坑,还是等Vue3.0的发布吧,到那个时候肯定结合得会更好。1 How to fix TSLint: " should be ' (quotemark) while doing organize imports in code editors?In User Preferences set the following.

Vue + typescript 挖坑记

VueCli3.0生成Vue+ts的项目组件,中间遇到了一些让我直接放弃结合ts的坑,还是等Vue3.0的发布吧,到那个时候肯定结合得会更好。

1 How to fix TSLint: " should be ' (quotemark) while doing organize imports in code editors?

In User Preferences set the following.

"tslint.autoFixOnSave": true

2 tslint Missing semicolon (semicolon)

分析:在vuetur的github>issue中有讲,vue-tslint的代码检查不太好,强制要求每个vue单文件组件里必须要有以下代码

<script lang="ts">
</script>

3 App.vue' is not a module.

分析:弄完第二个问题后,cli紧接着就报了这个错误。想了解的话,请戳vuecli_ts > Github上的这个 Issue ,下面给了一种临时性的解决方案(真的挺丑的),真正的解决还是得等vue3.0的正式发布。

解决方法:// @ts-ignore before each import '*.vue' could be a temporary solution.

// @ts-ignore
import HelloWorld from '@/components/HelloWorld/HelloWorld.vue';

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Code Complete

Code Complete

Steve McConnell / Microsoft Press / 2004-6-19 / GBP 40.99

在线阅读本书 Widely considered one of the best practical guides to programming, Steve McConnells original CODE COMPLETE has been helping developers write better software for more than a decade. Now......一起来看看 《Code Complete》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具