import { defineComponent } from 'vue' ; import Big from './Big' ; import Small from './Small' ; import createName from '@/utils/createName' ; import type { PropType } from 'vue' ; export type EarSize = 'small' | 'big' ; export default defineComponent ( { name : createName ( 'avatar' , 'ear' ) , props : { color : String , size : String as PropType < EarSize > , } , setup ( props ) { const renderEar = ( ) => { switch ( props . size ) { case 'big' : return < Big color = { props . color } />; case 'small' : return < Small color = { props . color } />; default : return < Small color = { props . color } />; } } ; return ( ) => < > { renderEar ( ) } < />; } , } ) ;