Skip to content

Commit c75e80a

Browse files
authored
fix: list css-var (#8324)
Co-authored-by: undefined <undefined>
1 parent 0410908 commit c75e80a

File tree

3 files changed

+150
-57
lines changed

3 files changed

+150
-57
lines changed

components/list/demo/simple.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Customizing the header and footer of list by setting `header` and `footer` prope
3333
<div>Footer</div>
3434
</template>
3535
</a-list>
36-
<h3 :style="{ marginBottom: '16px' }">Default Size</h3>
36+
<h3 :style="{ margin: '16px 0' }">Default Size</h3>
3737
<a-list bordered :data-source="data">
3838
<template #renderItem="{ item }">
3939
<a-list-item>{{ item }}</a-list-item>

components/list/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import eagerComputed from '../_util/eagerComputed';
2929

3030
// CSSINJS
3131
import useStyle from './style';
32+
import useCSSVarCls from '../config-provider/hooks/useCssVarCls';
3233

3334
export type { ListItemProps } from './Item';
3435
export type { ListItemMetaProps } from './ItemMeta';
@@ -110,7 +111,8 @@ const List = defineComponent({
110111
const { prefixCls, direction, renderEmpty } = useConfigInject('list', props);
111112

112113
// Style
113-
const [wrapSSR, hashId] = useStyle(prefixCls);
114+
const rootCls = useCSSVarCls(prefixCls);
115+
const [wrapSSR, hashId, cssVarCls] = useStyle(prefixCls, rootCls);
114116

115117
const paginationObj = computed(() =>
116118
props.pagination && typeof props.pagination === 'object' ? props.pagination : {},
@@ -274,7 +276,9 @@ const List = defineComponent({
274276
[`${prefixCls.value}-something-after-last-item`]: isSomethingAfterLastItem,
275277
},
276278
attrs.class,
279+
cssVarCls.value,
277280
hashId.value,
281+
rootCls.value,
278282
);
279283
const paginationContent = props.pagination ? (
280284
<div class={`${prefixCls.value}-pagination`}>

0 commit comments

Comments
 (0)