Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions components/card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { SizeType } from '../config-provider';
import isPlainObject from 'lodash-es/isPlainObject';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import devWarning from '../vc-util/devWarning';
import useStyle from './style';
export interface CardTabListType {
key: string;
tab: any;
Expand Down Expand Up @@ -51,10 +52,12 @@ export type CardProps = Partial<ExtractPropTypes<ReturnType<typeof cardProps>>>;
const Card = defineComponent({
compatConfig: { MODE: 3 },
name: 'ACard',
inheritAttrs: false,
props: cardProps(),
slots: ['title', 'extra', 'tabBarExtraContent', 'actions', 'cover', 'customTab'],
setup(props, { slots }) {
setup(props, { slots, attrs }) {
const { prefixCls, direction, size } = useConfigInject('card', props);
const [wrapSSR, hashId] = useStyle(prefixCls);
const getAction = (actions: VNodeTypes[]) => {
const actionList = actions.map((action, index) =>
(isVNode(action) && !isEmptyElement(action)) || !isVNode(action) ? (
Expand Down Expand Up @@ -99,6 +102,7 @@ const Card = defineComponent({
const pre = prefixCls.value;
const classString = {
[`${pre}`]: true,
[hashId.value]: true,
[`${pre}-loading`]: loading,
[`${pre}-bordered`]: bordered,
[`${pre}-hoverable`]: !!hoverable,
Expand Down Expand Up @@ -190,13 +194,13 @@ const Card = defineComponent({
const actionDom =
actions && actions.length ? <ul class={`${pre}-actions`}>{getAction(actions)}</ul> : null;

return (
<div class={classString} ref="cardContainerRef">
return wrapSSR(
<div ref="cardContainerRef" {...attrs} class={classString}>
{head}
{coverDom}
{children && children.length ? body : null}
{actionDom}
</div>
</div>,
);
};
},
Expand Down
308 changes: 0 additions & 308 deletions components/card/style/index.less

This file was deleted.

Loading