How to use validator for props value in typescript ?
type Props = {
name: string
type?: string // how to use "validator" ?
modelValue: any
}
const props = defineProps<Props>()
How to make it work as in the following declaration:
defineProps({
type: {
type: String,
validator(value) {
return ...
}
}
})
maybe this stack overflow answer would help you:
but usually, in cases like this, I just go to the official Vue Discord server and ask my questions there to get the best answer from the Vue core team
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.