From d4fe427d589a1b2f6b467b868956b83bbe52288a Mon Sep 17 00:00:00 2001 From: anlyyao Date: Mon, 10 Oct 2022 16:16:37 +0800 Subject: [PATCH] fix(NoticeBar): use the correct slot name --- src/notice-bar/__test__/index.test.jsx | 4 ++-- src/notice-bar/notice-bar.vue | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/notice-bar/__test__/index.test.jsx b/src/notice-bar/__test__/index.test.jsx index ea5b2c7c3..66d6cd9ee 100644 --- a/src/notice-bar/__test__/index.test.jsx +++ b/src/notice-bar/__test__/index.test.jsx @@ -107,7 +107,7 @@ describe('NoticeBar', async () => { const prefixIcon =
测试
; const wrapper = mount(, { slots: { - 'prefix-icon': prefixIcon, + 'prefixIcon': prefixIcon, }, }); await nextTick(); @@ -118,7 +118,7 @@ describe('NoticeBar', async () => { const suffixIcon =
测试
; const wrapper = mount(, { slots: { - 'suffix-icon': suffixIcon, + 'suffixIcon': suffixIcon, }, }); await nextTick(); diff --git a/src/notice-bar/notice-bar.vue b/src/notice-bar/notice-bar.vue index 4d04d62c5..c7bff7e43 100644 --- a/src/notice-bar/notice-bar.vue +++ b/src/notice-bar/notice-bar.vue @@ -90,7 +90,7 @@ export default defineComponent({ const computedPrefixIcon = ref(); watchEffect(() => { - if (!props.prefixIcon && !context.slots['prefix-icon']) { + if (!props.prefixIcon && !context.slots.prefixIcon) { const key = props.theme as string; computedPrefixIcon.value = iconDefault?.[key] || ''; } else {