mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
tabs优化id方式
This commit is contained in:
parent
3bf227e069
commit
d5332e8c3d
@ -27,7 +27,7 @@ exports[`Renderer:tabs 1`] = `
|
||||
>
|
||||
<div
|
||||
class="a-Tabs"
|
||||
id="1"
|
||||
id="0"
|
||||
>
|
||||
<ul
|
||||
class="a-Tabs-links nav"
|
||||
@ -38,10 +38,10 @@ exports[`Renderer:tabs 1`] = `
|
||||
role="presentation"
|
||||
>
|
||||
<a
|
||||
aria-controls="1-pane-0"
|
||||
aria-controls="0-pane-0"
|
||||
aria-selected="true"
|
||||
href="#"
|
||||
id="1-tab-0"
|
||||
id="0-tab-0"
|
||||
role="tab"
|
||||
>
|
||||
基本配置
|
||||
@ -52,10 +52,10 @@ exports[`Renderer:tabs 1`] = `
|
||||
role="presentation"
|
||||
>
|
||||
<a
|
||||
aria-controls="1-pane-1"
|
||||
aria-controls="0-pane-1"
|
||||
aria-selected="false"
|
||||
href="#"
|
||||
id="1-tab-1"
|
||||
id="0-tab-1"
|
||||
role="tab"
|
||||
tabindex="-1"
|
||||
>
|
||||
@ -68,9 +68,9 @@ exports[`Renderer:tabs 1`] = `
|
||||
>
|
||||
<div
|
||||
aria-hidden="false"
|
||||
aria-labelledby="1-tab-0"
|
||||
aria-labelledby="0-tab-0"
|
||||
class="fade tab-pane active in"
|
||||
id="1-pane-0"
|
||||
id="0-pane-0"
|
||||
role="tabpanel"
|
||||
>
|
||||
<span
|
||||
@ -83,9 +83,9 @@ exports[`Renderer:tabs 1`] = `
|
||||
</div>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
aria-labelledby="1-tab-1"
|
||||
aria-labelledby="0-tab-1"
|
||||
class="fade tab-pane"
|
||||
id="1-pane-1"
|
||||
id="0-pane-1"
|
||||
role="tabpanel"
|
||||
>
|
||||
<div
|
||||
|
@ -30,6 +30,8 @@ export interface TabsState {
|
||||
prevKey: any;
|
||||
}
|
||||
|
||||
let tabCount = 0;
|
||||
|
||||
export default class Tabs extends React.Component<TabsProps, TabsState> {
|
||||
static defaultProps: Partial<TabsProps> = {
|
||||
className: '',
|
||||
@ -38,7 +40,7 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
|
||||
unmountOnExit: false,
|
||||
};
|
||||
|
||||
id = 0;
|
||||
id = '' + tabCount++;
|
||||
constructor(props: TabsProps) {
|
||||
super(props);
|
||||
|
||||
@ -206,7 +208,7 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
|
||||
|
||||
return (
|
||||
<TabContainer
|
||||
id={'' + this.id++}
|
||||
id={this.id}
|
||||
className={cx(
|
||||
`Tabs`,
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user