【Vue】VueCli3 + Vue + typescript 挖坑记

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

内容简介: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';

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

查看所有标签

猜你喜欢:

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

Stylin' with CSS

Stylin' with CSS

Wyke-Smith, Charles / 2012-10 / $ 50.84

In this completely revised edition of his bestselling Stylin' with CSS, veteran designer and programmer Charles Wyke-Smith guides you through a comprehensive overview of designing Web pages with CSS, ......一起来看看 《Stylin' with CSS》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码