fix(empty): cannot get `prefixCls` in `configProvider` #4446 (#4447)

close #4446
pull/4453/head
John 2021-07-30 16:12:27 +08:00 committed by GitHub
parent a4ce890dd6
commit 6953698385
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -26,10 +26,14 @@ const Empty = {
props: {
...EmptyProps(),
},
inject: {
configProvider: { default: () => ConfigConsumerProps },
},
methods: {
renderEmpty(contentLocale) {
const { prefixCls: customizePrefixCls, imageStyle } = this.$props;
const prefixCls = ConfigConsumerProps.getPrefixCls('empty', customizePrefixCls);
const { getPrefixCls } = this.configProvider;
const prefixCls = getPrefixCls('empty', customizePrefixCls);
const image = getComponentFromProp(this, 'image') || <DefaultEmptyImg />;
const description = getComponentFromProp(this, 'description');