fix(tabs): disabled animated when tabPosition is left/right (#5464)

* fix(tabs): disabled animated when tabPosition is left/right

* fix(tabs): disabled animated when tabPosition is left/right

* test: update test

* test: update test & position demo
pull/5477/head
bqy_fe 2022-04-09 22:14:53 +08:00 committed by GitHub
parent 0c803216e5
commit 9b6bf4ac5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 9 deletions

View File

@ -452,12 +452,12 @@ exports[`renders ./components/tabs/demo/position.vue correctly 1`] = `
<!----> <!---->
</div> </div>
<div class="ant-tabs-content-holder"> <div class="ant-tabs-content-holder">
<div class="ant-tabs-content ant-tabs-content-top"> <div class="ant-tabs-content ant-tabs-content-top ant-tabs-content-animated">
<div role="tabpanel" tabindex="0" aria-hidden="false" class="ant-tabs-tabpane ant-tabs-tabpane-active" id="rc-tabs-test-panel-1" aria-labelledby="rc-tabs-test-tab-1">Content of Tab 1</div> <div role="tabpanel" tabindex="0" aria-hidden="false" class="ant-tabs-tabpane ant-tabs-tabpane-active" id="rc-tabs-test-panel-1" aria-labelledby="rc-tabs-test-tab-1">Content of Tab 1</div>
<div role="tabpanel" tabindex="-1" aria-hidden="true" style="display: none;" class="ant-tabs-tabpane" id="rc-tabs-test-panel-2" aria-labelledby="rc-tabs-test-tab-2"> <div role="tabpanel" tabindex="-1" aria-hidden="true" style="visibility: hidden; height: 0px; overflow-y: hidden;" class="ant-tabs-tabpane" id="rc-tabs-test-panel-2" aria-labelledby="rc-tabs-test-tab-2">
<!----> <!---->
</div> </div>
<div role="tabpanel" tabindex="-1" aria-hidden="true" style="display: none;" class="ant-tabs-tabpane" id="rc-tabs-test-panel-3" aria-labelledby="rc-tabs-test-tab-3"> <div role="tabpanel" tabindex="-1" aria-hidden="true" style="visibility: hidden; height: 0px; overflow-y: hidden;" class="ant-tabs-tabpane" id="rc-tabs-test-panel-3" aria-labelledby="rc-tabs-test-tab-3">
<!----> <!---->
</div> </div>
</div> </div>

View File

@ -11,7 +11,7 @@ exports[`Tabs tabPosition remove card 1`] = `
<!----> <!---->
</div> </div>
<!----> <!---->
<div class="ant-tabs-ink-bar ant-tabs-ink-bar-animated"></div> <div class="ant-tabs-ink-bar"></div>
</div> </div>
</div> </div>
<div class="ant-tabs-nav-operations ant-tabs-nav-operations-hidden"> <div class="ant-tabs-nav-operations ant-tabs-nav-operations-hidden">

View File

@ -23,7 +23,7 @@ Tab's position: left, right, top or bottom. Will auto switch to `top` in mobile
<a-radio-button value="left">left</a-radio-button> <a-radio-button value="left">left</a-radio-button>
<a-radio-button value="right">right</a-radio-button> <a-radio-button value="right">right</a-radio-button>
</a-radio-group> </a-radio-group>
<a-tabs v-model:activeKey="activeKey" :tab-position="tabPosition"> <a-tabs v-model:activeKey="activeKey" :tab-position="tabPosition" animated>
<a-tab-pane key="1" tab="Tab 1">Content of Tab 1</a-tab-pane> <a-tab-pane key="1" tab="Tab 1">Content of Tab 1</a-tab-pane>
<a-tab-pane key="2" tab="Tab 2">Content of Tab 2</a-tab-pane> <a-tab-pane key="2" tab="Tab 2">Content of Tab 2</a-tab-pane>
<a-tab-pane key="3" tab="Tab 3">Content of Tab 3</a-tab-pane> <a-tab-pane key="3" tab="Tab 3">Content of Tab 3</a-tab-pane>

View File

@ -22,7 +22,7 @@ Ant Design has 3 types of Tabs for different situations.
| Property | Description | Type | Default | Version | | Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| activeKey(v-model) | Current TabPane's key | string | - | | | activeKey(v-model) | Current TabPane's key | string | - | |
| animated | Whether to change tabs with animation. Only works while `tabPosition="top"\|"bottom"` | boolean \| {inkBar:boolean, tabPane:boolean} | `true`, `false` when `type="card"` | | | animated | Whether to change tabs with animation. Only works while tabPosition=`"top"` \| `"bottom"` | boolean \| {inkBar:boolean, tabPane:boolean} | `true`, `false` when `type="card"` | |
| destroyInactiveTabPane | Whether destroy inactive TabPane when change tab | boolean | false | | | destroyInactiveTabPane | Whether destroy inactive TabPane when change tab | boolean | false | |
| hideAdd | Hide plus icon or not. Only works while `type="editable-card"` | boolean | `false` | } | | hideAdd | Hide plus icon or not. Only works while `type="editable-card"` | boolean | `false` | } |
| size | preset tab bar size | `large` \| `default` \| `small` | `default` | | | size | preset tab bar size | `large` \| `default` \| `small` | `default` | |

View File

@ -25,7 +25,7 @@ Ant Design 依次提供了三级选项卡,分别用于不同的场景。
| 参数 | 说明 | 类型 | 默认值 | 版本 | | | 参数 | 说明 | 类型 | 默认值 | 版本 | |
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| activeKey(v-model) | 当前激活 tab 面板的 key | string | 无 | | | | activeKey(v-model) | 当前激活 tab 面板的 key | string | 无 | | |
| animated | 是否使用动画切换 Tabs\`tabPosition=top | bottom\` 时有效 | boolean \| {inkBar:boolean, tabPane:boolean} | true, 当 type="card" 时为 false | | | animated | 是否使用动画切换 TabstabPosition=`"top"` \| `"bottom"` 时有效 | boolean \| {inkBar:boolean, tabPane:boolean} | true, 当 type="card" 时为 false | |
| centered | 标签居中展示 | boolean | false | 3.0 | | | centered | 标签居中展示 | boolean | false | 3.0 | |
| destroyInactiveTabPane | 被隐藏时是否销毁 DOM 结构 | boolean | false | | | | destroyInactiveTabPane | 被隐藏时是否销毁 DOM 结构 | boolean | false | | |
| hideAdd | 是否隐藏加号图标,在 `type="editable-card"` 时有效 | boolean | false | | | | hideAdd | 是否隐藏加号图标,在 `type="editable-card"` 时有效 | boolean | false | | |

View File

@ -155,8 +155,8 @@ const InternalTabs = defineComponent({
const { prefixCls, direction, size, rootPrefixCls } = useConfigInject('tabs', props); const { prefixCls, direction, size, rootPrefixCls } = useConfigInject('tabs', props);
const rtl = computed(() => direction.value === 'rtl'); const rtl = computed(() => direction.value === 'rtl');
const mergedAnimated = computed<AnimatedConfig>(() => { const mergedAnimated = computed<AnimatedConfig>(() => {
const { animated } = props; const { animated, tabPosition } = props;
if (animated === false) { if (animated === false || ['left', 'right'].includes(tabPosition)) {
return { return {
inkBar: false, inkBar: false,
tabPane: false, tabPane: false,