【Vue】VueCli3 + Vue + typescript 挖坑记

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

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

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

查看所有标签

猜你喜欢:

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

iGen

iGen

Jean M. Twenge PhD / Atria Books / 2017-8-22 / USD 27.00

A highly readable and entertaining first look at how today’s members of iGen—the children, teens, and young adults born in the mid-1990s and later—are vastly different from their Millennial predecesso......一起来看看 《iGen》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

在线进制转换器
在线进制转换器

各进制数互转换器

SHA 加密
SHA 加密

SHA 加密工具