vuejs-challenges
vuejs-challenges copied to clipboard
323 - Prop验证
// 你的答案
<script setup>
defineProps({
type: {
type: String,
default: 'default',
validator(val) {
return ['primary' , 'ghost' , 'dashed' , 'link' , 'text' , 'default'].includes(val)
}
},
})
</script>