fix(theme): fix rendering failure when actions is missing (#476)

This commit is contained in:
pengzhanbo 2025-02-23 01:49:19 +08:00 committed by GitHub
parent 49b37962e5
commit 4f998a16c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -2,8 +2,12 @@
import type { PlumeThemeHomeDocHero } from '../../../shared/index.js'
import VPButton from '@theme/VPButton.vue'
import VPImage from '@theme/VPImage.vue'
import { computed } from 'vue'
defineProps<PlumeThemeHomeDocHero>()
const props = defineProps<PlumeThemeHomeDocHero>()
const hero = computed(() => props.hero ?? {})
const actions = computed(() => hero.value.actions ?? [])
</script>
<template>
@ -16,10 +20,10 @@ defineProps<PlumeThemeHomeDocHero>()
</h1>
<p v-if="hero.tagline" class="tagline" v-html="hero.tagline" />
<div v-if="hero.actions.length" class="actions">
<div v-if="actions.length" class="actions">
<div class="action">
<VPButton
v-for="action in hero.actions"
v-for="action in actions"
:key="action.link"
tag="a"
size="medium"

View File

@ -10,9 +10,6 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
type: 'tip',
text: undefined,
color: undefined,
bgColor: undefined,
borderColor: 'transparent',
})