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

잔글 (Jmnote님이 DefineProps 문서를 Vue.js defineProps 문서로 이동했습니다)
5번째 줄: 5번째 줄:
const props = defineProps({
const props = defineProps({
   foo: String
   foo: String
})
</syntaxhighlight>
<syntaxhighlight lang='typescript'>
const props = defineProps<{
  foo: string
  bar?: number
}>()
</syntaxhighlight>
<syntaxhighlight lang='typescript'>
export interface Props {
  msg?: string
  labels?: string[]
}
const props = withDefaults(defineProps<Props>(), {
  msg: 'hello',
  labels: () => ['one', 'two']
})
})
</syntaxhighlight>
</syntaxhighlight>

2023년 10월 13일 (금) 12:38 판

1 개요

Vue.js defineProps
const props = defineProps({
  foo: String
})
const props = defineProps<{
  foo: string
  bar?: number
}>()
export interface Props {
  msg?: string
  labels?: string[]
}

const props = withDefaults(defineProps<Props>(), {
  msg: 'hello',
  labels: () => ['one', 'two']
})

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}