Skip to content

Commit ecaf2d5

Browse files
chore: defining default values for Props using withDefaults (#1880)
[skip ci]
1 parent 9aa1108 commit ecaf2d5

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

packages/docs/.vitepress/theme/components/HomeSponsorsGroup.vue

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,19 @@
3131
<script setup lang="ts">
3232
import sponsors from './sponsors.json'
3333
import { computed } from 'vue'
34-
import type { PropType } from 'vue'
3534
import { useData } from 'vitepress'
3635
37-
const { isDark } = useData()
36+
interface Props {
37+
name: 'Gold' | 'Platinum' | 'Silver' | 'Bronze'
38+
size?: number | string
39+
}
3840
39-
const props = defineProps({
40-
name: {
41-
type: String as PropType<'Gold' | 'Platinum' | 'Silver' | 'Bronze'>,
42-
required: true,
43-
},
44-
size: {
45-
type: [Number, String],
46-
default: 140,
47-
},
41+
const props = withDefaults(defineProps<Props>(), {
42+
size: 140,
4843
})
4944
45+
const { isDark } = useData()
46+
5047
const list = computed(() =>
5148
sponsors[props.name.toLowerCase()].map((sponsor) => ({
5249
...sponsor,

0 commit comments

Comments
 (0)