From 4b7c6ac02cafb4ffb83cb991f797f60a290d8a62 Mon Sep 17 00:00:00 2001 From: trry-hub <67309192+trry-hub@users.noreply.github.com> Date: Mon, 10 Jun 2024 09:14:27 +0800 Subject: [PATCH] feat: TourStep support fn children (#7628) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix: [修复自定义按钮无渲染] * refactor(完善 Tour 自定义按钮代码健壮性): 🦄 --------- Co-authored-by: shizhu --- components/tour/panelRender.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/tour/panelRender.tsx b/components/tour/panelRender.tsx index 105a0dffd..b245ed435 100644 --- a/components/tour/panelRender.tsx +++ b/components/tour/panelRender.tsx @@ -1,5 +1,6 @@ import { computed, defineComponent, toRefs } from 'vue'; import classNames from '../_util/classNames'; +import { isFunction } from '../_util/util'; import CloseOutlined from '@ant-design/icons-vue/CloseOutlined'; import { tourStepProps } from './interface'; import type { TourBtnProps } from './interface'; @@ -119,7 +120,9 @@ const panelRender = defineComponent({ size="small" class={classNames(`${prefixCls}-prev-btn`, prevButtonProps?.className)} > - {prevButtonProps?.children ?? contextLocale.Previous} + {isFunction(prevButtonProps?.children) + ? prevButtonProps.children() + : prevButtonProps?.children ?? contextLocale.Previous} ) : null}