From 92146328411c6d0e46c1c2f92d80c88d9125dd50 Mon Sep 17 00:00:00 2001 From: Amour1688 Date: Mon, 12 Oct 2020 15:47:32 +0800 Subject: [PATCH] fix: config-provider renderEmpty --- antdv-demo | 2 +- components/_util/props-util.js | 5 ----- components/config-provider/index.tsx | 4 ++-- components/config-provider/renderEmpty.tsx | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/antdv-demo b/antdv-demo index 88970d13f..83ab203d1 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit 88970d13f8e2e6f5c96a28697fe0b399eccdcb07 +Subproject commit 83ab203d1ab9861132f6efd1e74015507c0e45f6 diff --git a/components/_util/props-util.js b/components/_util/props-util.js index 9120d20d2..df28ca8c2 100644 --- a/components/_util/props-util.js +++ b/components/_util/props-util.js @@ -40,10 +40,6 @@ const parseStyleText = (cssText = '', camel) => { return res; }; -const getComponentFromSetup = (props, slots, name, options) => { - return props[name] ? props[name] : slots[name]?.(options); -}; - const hasProp = (instance, prop) => { return prop in getOptionProps(instance); }; @@ -394,7 +390,6 @@ function isValidElement(element) { } export { - getComponentFromSetup, splitAttrs, hasProp, getOptionProps, diff --git a/components/config-provider/index.tsx b/components/config-provider/index.tsx index 0ad37e5e0..0d7d191a0 100644 --- a/components/config-provider/index.tsx +++ b/components/config-provider/index.tsx @@ -1,6 +1,5 @@ import { reactive, provide, VNodeTypes, PropType, defineComponent, App } from 'vue'; import PropTypes from '../_util/vue-types'; -import { getComponentFromSetup } from '../_util/props-util'; import defaultRenderEmpty, { RenderEmptyHandler } from './renderEmpty'; import LocaleProvider, { Locale, ANT_MARK } from '../locale-provider'; @@ -117,7 +116,8 @@ const ConfigProvider = defineComponent({ }; const renderEmptyComponent = (name?: string) => { - const renderEmpty = (getComponentFromSetup(props, slots, 'renderEmpty') || + const renderEmpty = (props.renderEmpty || + slots.renderEmpty || defaultRenderEmpty) as RenderEmptyHandler; return renderEmpty(name); }; diff --git a/components/config-provider/renderEmpty.tsx b/components/config-provider/renderEmpty.tsx index c3e86039d..0dbc8ec95 100644 --- a/components/config-provider/renderEmpty.tsx +++ b/components/config-provider/renderEmpty.tsx @@ -27,7 +27,7 @@ const RenderEmpty = (props: RenderEmptyProps) => { return ; } }; - return () => renderHtml(props.componentName); + return renderHtml(props.componentName); }; function renderEmpty(componentName?: string) {