【Vue】VueCli3 + Vue + typescript 挖坑記

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'; 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章