From 0816c3f863749b054fb2daf680f0f3379d4ed860 Mon Sep 17 00:00:00 2001 From: Farnabaz Date: Mon, 14 Jun 2021 12:56:33 +0430 Subject: [PATCH] fix(CodeGroup): prevent undefined error --- src/defaultTheme/components/atoms/CodeGroup.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/defaultTheme/components/atoms/CodeGroup.vue b/src/defaultTheme/components/atoms/CodeGroup.vue index bf9fa2819..20d6dc673 100644 --- a/src/defaultTheme/components/atoms/CodeGroup.vue +++ b/src/defaultTheme/components/atoms/CodeGroup.vue @@ -100,7 +100,7 @@ export default defineComponent({ const attrs = slot.asyncMeta?.data?.attrs || slot.componentOptions?.propsData || {} const [firstChild] = slot.children || slot.componentOptions?.children || slot.asyncMeta?.children || [] return { - label: attrs.label || firstChild?.children[0].text || 'untitled', + label: attrs.label || firstChild?.children?.[0]?.text || 'untitled', active: typeof attrs.active !== 'undefined' } }) @@ -115,11 +115,11 @@ export default defineComponent({ @apply my-4; ::v-deep { - .docus-highlight:not(.active) { + > .docus-highlight:not(.active) { display: none; } - .code-block:not(.active) { + > .code-block:not(.active) { display: none; }