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>
|
||||
<v-list-item :color="color" :title="title">
|
||||
<v-list-item :style="{ color }" :title="title">
|
||||
{{ count }}
|
||||
</v-list-item>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const props = defineProps<{
|
||||
defineProps<{
|
||||
title: string
|
||||
count: number
|
||||
color?: string
|
||||
color: string
|
||||
}>()
|
||||
|
||||
// Provide default values for props
|
||||
const { color = 'primary' } = withDefaults(props, {
|
||||
color: 'primary'
|
||||
})
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user