Skip to content

Commit 5a627b3

Browse files
authored
feat: update empty (#2360)
* feat: update empty * Update index.js
1 parent 9063d17 commit 5a627b3

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

components/empty/index.jsx

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import PropTypes from '../_util/vue-types';
22
import { ConfigConsumerProps } from '../config-provider';
3-
import { getComponentFromProp, getListeners } from '../_util/props-util';
3+
import { getComponent } from '../_util/props-util';
44
import LocaleReceiver from '../locale-provider/LocaleReceiver';
55
import DefaultEmptyImg from './empty';
66
import SimpleEmptyImg from './simple';
7-
import Base from '../base';
87

98
export const TransferLocale = () => {
109
return {
@@ -30,8 +29,8 @@ const Empty = {
3029
renderEmpty(contentLocale) {
3130
const { prefixCls: customizePrefixCls, imageStyle } = this.$props;
3231
const prefixCls = ConfigConsumerProps.getPrefixCls('empty', customizePrefixCls);
33-
const image = getComponentFromProp(this, 'image') || <DefaultEmptyImg />;
34-
const description = getComponentFromProp(this, 'description');
32+
const image = getComponent(this, 'image') || <DefaultEmptyImg />;
33+
const description = getComponent(this, 'description');
3534

3635
const des = typeof description !== 'undefined' ? description : contentLocale.description;
3736
const alt = typeof des === 'string' ? des : 'empty';
@@ -47,7 +46,7 @@ const Empty = {
4746
imageNode = image;
4847
}
4948
return (
50-
<div class={cls} {...{ on: getListeners(this) }}>
49+
<div class={cls}>
5150
<div class={`${prefixCls}-image`} style={imageStyle}>
5251
{imageNode}
5352
</div>
@@ -66,9 +65,8 @@ Empty.PRESENTED_IMAGE_DEFAULT = DefaultEmptyImg;
6665
Empty.PRESENTED_IMAGE_SIMPLE = SimpleEmptyImg;
6766

6867
/* istanbul ignore next */
69-
Empty.install = function(Vue) {
70-
Vue.use(Base);
71-
Vue.component(Empty.name, Empty);
68+
Empty.install = function(app) {
69+
app.component(Empty.name, Empty);
7270
};
7371

7472
export default Empty;

examples/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Affix from 'ant-design-vue/affix';
77
import Alert from 'ant-design-vue/alert';
88
import ConfigProvider from 'ant-design-vue/config-provider';
99
import Spin from 'ant-design-vue/Spin';
10+
import Empty from 'ant-design-vue/empty';
1011
import 'ant-design-vue/style.js';
1112

1213
createApp(App)
@@ -16,4 +17,5 @@ createApp(App)
1617
.use(Affix)
1718
.use(Alert)
1819
.use(Spin)
20+
.use(Empty)
1921
.mount('#app');

0 commit comments

Comments
 (0)