feat: add prop tab-size for card (#3762)

* feat: add param tab-size for card

* feat: add param tab-size for card
pull/3784/head
Kaworus 2021-03-09 15:52:18 +08:00 committed by GitHub
parent 48181af9d6
commit dced59c65c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 12 deletions

View File

@ -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,
@ -73,6 +74,7 @@ export default {
size = 'default',
type,
tabList,
tabProps = {},
hoverable,
activeTabKey,
defaultActiveTabKey,
@ -145,7 +147,7 @@ export default {
const hasActiveTabKey = activeTabKey !== undefined;
const tabsProps = {
props: {
size: 'large',
...tabProps,
[hasActiveTabKey ? 'activeKey' : 'defaultActiveKey']: hasActiveTabKey
? activeTabKey
: defaultActiveTabKey,

View File

@ -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>