原生繞過 Vue3 setup defineProps 無法 import 的問題
defineProps 不能識別外部 import 的問題在去年八月份就有人提出來了 (https://github.com/vuejs/core/issues/4294),過了一年快半 Vue 還是把它作為 rfcs 掛在那里,令人感嘆。
具體表現(xiàn)如下。

在這里使用 defineProps 導(dǎo)入一個外部 interface,會直接報錯。

這里不在 defineProps<>當(dāng)中進(jìn)行類型定義,而使用 PropType 進(jìn)行定義可以繞過。


標(biāo)簽: