diff --git a/components/empty/index.jsx b/components/empty/index.jsx index 2501864ed..f34eb2b94 100644 --- a/components/empty/index.jsx +++ b/components/empty/index.jsx @@ -1,10 +1,9 @@ import PropTypes from '../_util/vue-types'; import { ConfigConsumerProps } from '../config-provider'; -import { getComponentFromProp, getListeners } from '../_util/props-util'; +import { getComponent } from '../_util/props-util'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; import DefaultEmptyImg from './empty'; import SimpleEmptyImg from './simple'; -import Base from '../base'; export const TransferLocale = () => { return { @@ -30,8 +29,8 @@ const Empty = { renderEmpty(contentLocale) { const { prefixCls: customizePrefixCls, imageStyle } = this.$props; const prefixCls = ConfigConsumerProps.getPrefixCls('empty', customizePrefixCls); - const image = getComponentFromProp(this, 'image') || ; - const description = getComponentFromProp(this, 'description'); + const image = getComponent(this, 'image') || ; + const description = getComponent(this, 'description'); const des = typeof description !== 'undefined' ? description : contentLocale.description; const alt = typeof des === 'string' ? des : 'empty'; @@ -47,7 +46,7 @@ const Empty = { imageNode = image; } return ( -
+
{imageNode}
@@ -66,9 +65,8 @@ Empty.PRESENTED_IMAGE_DEFAULT = DefaultEmptyImg; Empty.PRESENTED_IMAGE_SIMPLE = SimpleEmptyImg; /* istanbul ignore next */ -Empty.install = function(Vue) { - Vue.use(Base); - Vue.component(Empty.name, Empty); +Empty.install = function(app) { + app.component(Empty.name, Empty); }; export default Empty; diff --git a/examples/index.js b/examples/index.js index a4fe5e028..28577de5f 100644 --- a/examples/index.js +++ b/examples/index.js @@ -7,6 +7,7 @@ import Affix from 'ant-design-vue/affix'; import Alert from 'ant-design-vue/alert'; import ConfigProvider from 'ant-design-vue/config-provider'; import Spin from 'ant-design-vue/Spin'; +import Empty from 'ant-design-vue/empty'; import 'ant-design-vue/style.js'; createApp(App) @@ -16,4 +17,5 @@ createApp(App) .use(Affix) .use(Alert) .use(Spin) + .use(Empty) .mount('#app');