Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
fix: modify tab default active key
Browse files Browse the repository at this point in the history
Signed-off-by: Teacatkk <307519856@qq.com>
  • Loading branch information
Teacatkk committed Jun 7, 2023
1 parent 185cce6 commit 2d9fd6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wizard-ui",
"version": "1.0.0-beta.11",
"version": "1.0.0-beta.13",
"private": false,
"main": "lib/index.js",
"module": "esm/index.js",
Expand Down
10 changes: 3 additions & 7 deletions src/components/Tabs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import lodash from 'lodash';
import { Tab, Card, NavDropdown, Dropdown, Nav, NavItem, NavLink } from 'react-bootstrap';
import { getBemClass } from '../../utils';
import { TabsProps } from '../../interface';
import './style.scss';
import lang from '../../locale/language';
import classNames from 'classnames';

const MORE_TITLE = lang().MORE_TITLE;

Expand All @@ -25,11 +26,6 @@ const Tabs: React.FC<TabsProps & { type?: 'secondary'}> = props => {
} = props;

const [keyTitle, setKeyTitleValue] = React.useState<string>(MORE_TITLE);
const TabsPan = restProps.activeKey
? tabs.find(item => {
return item[eventKeyName] === restProps.activeKey;
})
: tabs[0];
const tabsFrontList = tabs.slice(0, limitNum);
const tabsLastList = tabs.slice(limitNum, tabs.length);
const lastActiveKeys = tabsLastList.map((list: any) => list[eventKeyName]);
Expand Down Expand Up @@ -57,7 +53,7 @@ const Tabs: React.FC<TabsProps & { type?: 'secondary'}> = props => {
<div className={classNames(className, getBemClass('Tabs', [size, direction, type]))}>
<Tab.Container
id="tabs-with-dropdown"
defaultActiveKey={TabsPan[eventKeyName]}
defaultActiveKey={lodash.get(tabs, `0.${eventKeyName}`, '')}
mountOnEnter={mountOnEnter}
unmountOnExit={unmountOnExit}
transition={transition}
Expand Down

0 comments on commit 2d9fd6b

Please sign in to comment.