11import type { ExtractPropTypes } from 'vue' ;
22import { defineComponent , computed } from 'vue' ;
3- import { getPropsSlot } from '../_util/props-util' ;
43import PropTypes from '../_util/vue-types' ;
54
65export const starProps = {
@@ -24,7 +23,7 @@ export default defineComponent({
2423 inheritAttrs : false ,
2524 props : starProps ,
2625 emits : [ 'hover' , 'click' ] ,
27- setup ( props , { slots , emit } ) {
26+ setup ( props , { emit } ) {
2827 const onHover = ( e : MouseEvent ) => {
2928 const { index } = props ;
3029 emit ( 'hover' , e , index ) ;
@@ -61,8 +60,17 @@ export default defineComponent({
6160 } ) ;
6261
6362 return ( ) => {
64- const { disabled, prefixCls, characterRender, index, count, value } = props ;
65- const character = getPropsSlot ( slots , props , 'character' ) ;
63+ const { disabled, prefixCls, characterRender, character, index, count, value } = props ;
64+ const characterNode =
65+ typeof character === 'function'
66+ ? character ( {
67+ disabled,
68+ prefixCls,
69+ index,
70+ count,
71+ value,
72+ } )
73+ : character ;
6674 let star = (
6775 < li class = { cls . value } >
6876 < div
@@ -75,8 +83,8 @@ export default defineComponent({
7583 aria-setsize = { count }
7684 tabindex = { disabled ? - 1 : 0 }
7785 >
78- < div class = { `${ prefixCls } -first` } > { character } </ div >
79- < div class = { `${ prefixCls } -second` } > { character } </ div >
86+ < div class = { `${ prefixCls } -first` } > { characterNode } </ div >
87+ < div class = { `${ prefixCls } -second` } > { characterNode } </ div >
8088 </ div >
8189 </ li >
8290 ) ;
0 commit comments