fix: empty duplicate class

pull/2926/head
Amour1688 2020-09-16 12:54:54 +08:00
parent 7cec8614b0
commit b5dd6c69b3
1 changed files with 8 additions and 10 deletions

View File

@ -1,5 +1,5 @@
import { CSSProperties, VNodeTypes, inject, App, SetupContext } from 'vue'; import { CSSProperties, VNodeTypes, inject, App, SetupContext } from 'vue';
import classNames from 'classnames'; import classNames from '../_util/classNames';
import { ConfigConsumerProps } from '../config-provider'; import { ConfigConsumerProps } from '../config-provider';
import LocaleReceiver from '../locale-provider/LocaleReceiver'; import LocaleReceiver from '../locale-provider/LocaleReceiver';
import DefaultEmptyImg from './empty'; import DefaultEmptyImg from './empty';
@ -28,10 +28,10 @@ const Empty = (props: EmptyProps, { slots }: SetupContext) => {
const { getPrefixCls } = configProvider; const { getPrefixCls } = configProvider;
const { const {
prefixCls: customizePrefixCls, prefixCls: customizePrefixCls,
class: className,
image = defaultEmptyImg, image = defaultEmptyImg,
description, description,
imageStyle, imageStyle,
class: className,
...restProps ...restProps
} = props; } = props;
@ -52,13 +52,9 @@ const Empty = (props: EmptyProps, { slots }: SetupContext) => {
return ( return (
<div <div
class={classNames( class={classNames(prefixCls, {
prefixCls,
{
[`${prefixCls}-normal`]: image === simpleEmptyImg, [`${prefixCls}-normal`]: image === simpleEmptyImg,
}, })}
className,
)}
{...restProps} {...restProps}
> >
<div class={`${prefixCls}-image`} style={imageStyle}> <div class={`${prefixCls}-image`} style={imageStyle}>
@ -75,12 +71,14 @@ const Empty = (props: EmptyProps, { slots }: SetupContext) => {
); );
}; };
Empty.displayName = 'AEmpty';
Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg; Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg;
Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg; Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg;
/* istanbul ignore next */ /* istanbul ignore next */
Empty.install = function(app: App) { Empty.install = function(app: App) {
app.component('AEmpty', Empty); app.component(Empty.displayName, Empty);
}; };
export default Empty; export default Empty;