[英]Can't pass prop to component in svelte with typescript
我有這個帶有標題道具的 BigButton 組件
<script lang="ts">
let title: string;
</script>
<h1 class="text-2xl mb-4 font-extrabold">{title}</h1>
然后在我的 index.svelte 上,我嘗試以不同的方式傳遞道具,但它們都不起作用:
<BigButton title={'Join a Game'} />
<BigButton title='Join a Game' />
棉絨給了我以下錯誤:
Type '{ title: string; }' is not assignable to type 'IntrinsicAttributes'.
Property 'title' does not exist on type 'IntrinsicAttributes'.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.