props type tips
What problem does this feature solve?
cant get props type tips in custome type
component A
<template>
{{ type }}
</template>
<script setup lang='ts'>
import { defineProps } from 'vue'
defineProps({
type: {
default: 'success',
validator(value: string) {
return ['success', 'error', 'warn'].includes(value)
}
}
})
</script>
<A type='success'></A>
when i use the component, props 'type' has not type prompt.
What does the proposed API look like?
defineProps
Can you provide more information, I did not reproduce your problem. see
em... I mean when i use this component and enter 'type="success"', i cant get TypeScript syntax hints. But in this compoent, i had set the type of 'type' with 'success' or 'error' or 'warn'.