Skip to content

Commit dced59c

Browse files
authored
feat: add prop tab-size for card (#3762)
* feat: add param tab-size for card * feat: add param tab-size for card
1 parent 48181af commit dced59c

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

components/card/Card.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default {
2929
size: PropTypes.oneOf(['default', 'small']),
3030
actions: PropTypes.any,
3131
tabList: PropTypes.array,
32+
tabProps: PropTypes.object,
3233
tabBarExtraContent: PropTypes.any,
3334
activeTabKey: PropTypes.string,
3435
defaultActiveTabKey: PropTypes.string,
@@ -73,6 +74,7 @@ export default {
7374
size = 'default',
7475
type,
7576
tabList,
77+
tabProps = {},
7678
hoverable,
7779
activeTabKey,
7880
defaultActiveTabKey,
@@ -145,7 +147,7 @@ export default {
145147
const hasActiveTabKey = activeTabKey !== undefined;
146148
const tabsProps = {
147149
props: {
148-
size: 'large',
150+
...tabProps,
149151
[hasActiveTabKey ? 'activeKey' : 'defaultActiveKey']: hasActiveTabKey
150152
? activeTabKey
151153
: defaultActiveTabKey,

examples/App.vue

+32-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
11
<template>
22
<div>
3-
<a-collapse :accordion="true" default-active-key="2" :bordered="false">
4-
<a-collapse-panel key="1" header="This is panel header 1">
5-
<p>{{ text }}</p>
6-
</a-collapse-panel>
7-
<a-collapse-panel key="2" header="This is panel header 2" :disabled="false">
8-
<p>{{ text }}</p>
9-
</a-collapse-panel>
10-
<a-collapse-panel key="3" header="This is panel header 3">
11-
<p>{{ text }}</p>
12-
</a-collapse-panel>
13-
</a-collapse>
3+
<a-card
4+
title="测试"
5+
:tab-props="{ size: 'small' }"
6+
:tab-list="[
7+
{ key: 'tab1', tab: 'tab1' },
8+
{ key: 'tab2', tab: 'tab2' },
9+
]"
10+
/>
11+
<a-card
12+
title="测试"
13+
:tab-props="{ size: 'large' }"
14+
:tab-list="[
15+
{ key: 'tab1', tab: 'tab1' },
16+
{ key: 'tab2', tab: 'tab2' },
17+
]"
18+
/>
19+
<a-card
20+
title="测试"
21+
:tab-props="{}"
22+
:tab-list="[
23+
{ key: 'tab1', tab: 'tab1' },
24+
{ key: 'tab2', tab: 'tab2' },
25+
]"
26+
/>
27+
<a-card
28+
title="测试"
29+
:tab-props="{ size: 'default' }"
30+
:tab-list="[
31+
{ key: 'tab1', tab: 'tab1' },
32+
{ key: 'tab2', tab: 'tab2' },
33+
]"
34+
/>
1435
</div>
1536
</template>
1637
<script>

0 commit comments

Comments
 (0)