Skip to content

Commit

Permalink
chore: defining default values for Props using withDefaults (vuejs#2256)
Browse files Browse the repository at this point in the history
  • Loading branch information
niceplugin committed Oct 27, 2023
1 parent 873cff3 commit 77186be
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions docs/.vitepress/theme/components/HomeSponsorsGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,19 @@
<script setup lang="ts">
import sponsors from './sponsors.json'
import { computed } from 'vue'
import type { PropType } from 'vue'
import { useData } from 'vitepress'
const { isDark } = useData()
const props = withDefaults(
defineProps<{
name: 'Gold' | 'Platinum' | 'Silver' | 'Bronze'
size?: number | string
}>(),
{
size: 140,
}
)
const props = defineProps({
name: {
type: String as PropType<'Gold' | 'Platinum' | 'Silver' | 'Bronze'>,
required: true,
},
size: {
type: [Number, String],
default: 140,
},
})
const { isDark } = useData()
const list = computed(() =>
sponsors[props.name.toLowerCase()].map((sponsor) => ({
Expand Down

0 comments on commit 77186be

Please sign in to comment.