vuejs-challenges
vuejs-challenges copied to clipboard
323 - Prop验证
<script setup>
defineProps({
type: {
type:String,
validator(value){
return ['primary','ghost','dashed','link','text','default'].includes(value)
},
default:'default'
},
})
</script>
<template>
<button>Button</button>
</template>
// https://sfc.vuejs.org/#eNp9UU1PwzAM/StRLh3S1tyrMgl+ARJHwiFb3S2j+ZDjDKZp/x2njYaEEKf42c8v9vNVPsXYnjPITvZpjzaSSEA5brW3LgYk8ZyJghcjBie0bNWCS4+W2vdq6WI+AwIXJ0PASIi+dtIlwqOWk/UfWiou9erOk2v5o/fHDAOM1sMLhphW1yJaxDoxhxW8Elp/WC+Zs5nsYCjgiqMMD5UoBLIgevHWRLTO4KVZN4djSMTvYNIRBg7KhPwQfM1pGE2eqHlvrd9PeYBUNRfJW/2x0ro7v6RL8cbE/9zZzXtvl/V7VeFvd5YjbJyJ7SkFzxbNK+laSFre3dByvknHwZEopk6pNO6LsafUBjwojlrMnqyDFpLb7DB8JkAWLpfkqXloefsGeHO3hw==