Skip to content

Commit

Permalink
fix(rate): fix not display in nuxt
Browse files Browse the repository at this point in the history
  • Loading branch information
flsion committed Jan 19, 2024
1 parent 002604f commit 3ba750d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/web-vue/components/rate/rate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,18 @@ export default defineComponent({
};
};

const renderElement = (index: number) => {
if (props.grading) {
return renderGradingCharacter(index, displayIndex.value);
}
if (slots.character) {
return slots.character({ index });
}
return <IconStarFill />;
};

// TODO: need to perf
const renderCharacter = (index: number) => {
const displayCharacter = props.grading
? renderGradingCharacter(index, displayIndex.value)
: slots.character?.({ index }) ?? <IconStarFill />;

const leftProps = mergedDisabled.value
? {}
: {
Expand Down Expand Up @@ -289,15 +295,15 @@ export default defineComponent({
{...leftProps}
{...(props.allowHalf ? getAriaProps(index, true) : undefined)}
>
{displayCharacter}
{renderElement(index)}
</div>
<div
class={`${prefixCls}-character-right`}
style={rightStyle}
{...rightProps}
{...(props.allowHalf ? getAriaProps(index) : undefined)}
>
{displayCharacter}
{renderElement(index)}
</div>
</div>
);
Expand Down

0 comments on commit 3ba750d

Please sign in to comment.