fix(theme): fix rendering failure when actions is missing (#476)
This commit is contained in:
parent
49b37962e5
commit
4f998a16c3
@ -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"
|
||||
|
||||
@ -10,9 +10,6 @@ interface Props {
|
||||
}
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
type: 'tip',
|
||||
text: undefined,
|
||||
color: undefined,
|
||||
bgColor: undefined,
|
||||
borderColor: 'transparent',
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user