"Vue.js defineEmits"의 두 판 사이의 차이

잔글 (Jmnote님이 DefineEmits 문서를 Vue.js defineEmits 문서로 이동했습니다)
14번째 줄: 14번째 줄:
   update: [value: string]
   update: [value: string]
}>()
}>()
</syntaxhighlight>
<syntaxhighlight lang='html'>
<script setup>
const props = defineProps({
  foo: String
})
const emit = defineEmits(['change', 'delete'])
// setup code
</script>
</syntaxhighlight>
</syntaxhighlight>



2023년 10월 27일 (금) 15:44 판

1 개요

Vue.js defineEmits
typescript
Copy
const emit = defineEmits<{
  (e: 'change', id: number): void
  (e: 'update', value: string): void
}>()
typescript
Copy
// 3.3+
const emit = defineEmits<{
  change: [id: number]
  update: [value: string]
}>()
html
Copy
<script setup>
const props = defineProps({
  foo: String
})

const emit = defineEmits(['change', 'delete'])
// setup code
</script>

2 같이 보기

3 참고