Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add prop tab-size for card #3762

Merged
merged 3 commits into from
Mar 9, 2021
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
4 changes: 3 additions & 1 deletion components/card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default {
size: PropTypes.oneOf(['default', 'small']),
actions: PropTypes.any,
tabList: PropTypes.array,
tabProps: PropTypes.object,
tabBarExtraContent: PropTypes.any,
activeTabKey: PropTypes.string,
defaultActiveTabKey: PropTypes.string,
Expand Down Expand Up @@ -73,6 +74,7 @@ export default {
size = 'default',
type,
tabList,
tabProps = {},
hoverable,
activeTabKey,
defaultActiveTabKey,
Expand Down Expand Up @@ -145,7 +147,7 @@ export default {
const hasActiveTabKey = activeTabKey !== undefined;
const tabsProps = {
props: {
size: 'large',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不能remove啊,默认是large

...tabProps,
[hasActiveTabKey ? 'activeKey' : 'defaultActiveKey']: hasActiveTabKey
? activeTabKey
: defaultActiveTabKey,
Expand Down
43 changes: 32 additions & 11 deletions examples/App.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
<template>
<div>
<a-collapse :accordion="true" default-active-key="2" :bordered="false">
<a-collapse-panel key="1" header="This is panel header 1">
<p>{{ text }}</p>
</a-collapse-panel>
<a-collapse-panel key="2" header="This is panel header 2" :disabled="false">
<p>{{ text }}</p>
</a-collapse-panel>
<a-collapse-panel key="3" header="This is panel header 3">
<p>{{ text }}</p>
</a-collapse-panel>
</a-collapse>
<a-card
title="测试"
:tab-props="{ size: 'small' }"
:tab-list="[
{ key: 'tab1', tab: 'tab1' },
{ key: 'tab2', tab: 'tab2' },
]"
/>
<a-card
title="测试"
:tab-props="{ size: 'large' }"
:tab-list="[
{ key: 'tab1', tab: 'tab1' },
{ key: 'tab2', tab: 'tab2' },
]"
/>
<a-card
title="测试"
:tab-props="{}"
:tab-list="[
{ key: 'tab1', tab: 'tab1' },
{ key: 'tab2', tab: 'tab2' },
]"
/>
<a-card
title="测试"
:tab-props="{ size: 'default' }"
:tab-list="[
{ key: 'tab1', tab: 'tab1' },
{ key: 'tab2', tab: 'tab2' },
]"
/>
</div>
</template>
<script>
Expand Down