Refactor StatItem to use required color prop without defaults
Replaced optional `color` prop with a required one and removed default value handling. Simplified template binding by directly applying inline styles for color. This improves clarity and ensures consistent color usage.
This commit is contained in:
@@ -1,18 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-list-item :color="color" :title="title">
|
<v-list-item :style="{ color }" :title="title">
|
||||||
{{ count }}
|
{{ count }}
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
const props = defineProps<{
|
defineProps<{
|
||||||
title: string
|
title: string
|
||||||
count: number
|
count: number
|
||||||
color?: string
|
color: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
// Provide default values for props
|
|
||||||
const { color = 'primary' } = withDefaults(props, {
|
|
||||||
color: 'primary'
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user