From 96e81e947af706631d431df518247c7787e237c1 Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Thu, 4 Jun 2020 16:33:14 +0800 Subject: [PATCH 1/2] feat: update empty --- components/empty/index.jsx | 14 ++++++-------- examples/index.js | 2 ++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/empty/index.jsx b/components/empty/index.jsx index 2501864ed2..f34eb2b948 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 a4fe5e0282..6607b14849 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'); From eaa1df69aa9e0d3c9c707d9a822e76f1e89871db Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Thu, 4 Jun 2020 17:21:15 +0800 Subject: [PATCH 2/2] Update index.js --- examples/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/index.js b/examples/index.js index 6607b14849..28577de5fd 100644 --- a/examples/index.js +++ b/examples/index.js @@ -7,7 +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 Empty from 'ant-design-vue/empty'; import 'ant-design-vue/style.js'; createApp(App)