1.在需要使用的页面导入

  1. import {Tabs} from 'antd'
  2. const { TabPane } = Tabs;

2.使用

  1. <Tabs defaultActiveKey="1" onChange={this.callback}>
  2. <TabPane tab="Tab 1" key="1">
  3. Content of Tab Pane 1
  4. </TabPane>
  5. <TabPane tab="Tab 2" key="2">
  6. Content of Tab Pane 2
  7. </TabPane>
  8. </Tabs>,
  1. callback(key){
  2. console.log(key)
  3. }