From 36dae5ae8ca12eba30fb4e36587b7f46d6ab2c10 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 30 May 2021 20:49:21 +0800 Subject: [PATCH] feat(Button): add icon slot (#8783) --- src/button/Button.tsx | 4 ++++ src/button/README.md | 9 +++++---- src/button/README.zh-CN.md | 9 +++++---- src/button/test/__snapshots__/index.spec.ts.snap | 15 +++++++++++++++ src/button/test/index.spec.ts | 10 ++++++++++ 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/button/Button.tsx b/src/button/Button.tsx index 77724b788..11fe62667 100644 --- a/src/button/Button.tsx +++ b/src/button/Button.tsx @@ -89,6 +89,10 @@ export default defineComponent({ return renderLoadingIcon(); } + if (slots.icon) { + return
{slots.icon()}
; + } + if (props.icon) { return ( `; +exports[`should render icon slot correctly 1`] = ` + +`; + exports[`should render loading slot correctly 1`] = `