Skip to content

Commit 35f832c

Browse files
authored
feat: card css var (#8329)
1 parent 437fdda commit 35f832c

File tree

2 files changed

+183
-80
lines changed

2 files changed

+183
-80
lines changed

components/card/Card.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type { SizeType } from '../config-provider';
77
import isPlainObject from 'lodash-es/isPlainObject';
88
import useConfigInject from '../config-provider/hooks/useConfigInject';
99
import devWarning from '../vc-util/devWarning';
10+
import useCSSVarCls from '../config-provider/hooks/useCssVarCls';
1011
import useStyle from './style';
1112
import Skeleton from '../skeleton';
1213
import type { CustomSlotsType } from '../_util/type';
@@ -67,7 +68,8 @@ const Card = defineComponent({
6768
}>,
6869
setup(props, { slots, attrs }) {
6970
const { prefixCls, direction, size } = useConfigInject('card', props);
70-
const [wrapSSR, hashId] = useStyle(prefixCls);
71+
const rootCls = useCSSVarCls(prefixCls);
72+
const [wrapSSR, hashId, cssVarCls] = useStyle(prefixCls, rootCls);
7173
const getAction = (actions: VNodeTypes[]) => {
7274
const actionList = actions.map((action, index) =>
7375
(isVNode(action) && !isEmptyElement(action)) || !isVNode(action) ? (
@@ -112,6 +114,8 @@ const Card = defineComponent({
112114
const pre = prefixCls.value;
113115
const classString = {
114116
[`${pre}`]: true,
117+
[cssVarCls.value]: true,
118+
[rootCls.value]: true,
115119
[hashId.value]: true,
116120
[`${pre}-loading`]: loading,
117121
[`${pre}-bordered`]: bordered,

0 commit comments

Comments
 (0)