import { defineComponent } from 'vue' ; import Oval from './Oval' ; import Smile from './Smile' ; import Circle from './Circle' ; import createName from '@/utils/createName' ; import type { PropType } from 'vue' ; export type EyesType = 'circle' | 'oval' | 'smile' ; export default defineComponent ( { name : createName ( 'avatar' , 'eyes' ) , props : { type : String as PropType < EyesType > , } , setup ( props ) { const renderEyes = ( ) => { switch ( props . type ) { case 'circle' : return < Circle />; case 'oval' : return < Oval />; case 'smile' : return < Smile />; default : return < Oval />; } } ; return ( ) => < > { renderEyes ( ) } < />; } , } ) ;