[Vuejs]-In vue3 setup , how to both use defineProps with ts and value default?(Typescript)

4👍

You need to use withDefaults

type Props = {
  type?: string
  color?: 'color-primary' | 'color-danger' | 'color-plain' | undefined
}
const props = withDefaults(defineProps<Props>(), {
  type: 'plain',
  color: 'color-plain',
})
👤cos

Leave a comment