Demo.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import React from 'react';
  2. import Tabs from '../index';
  3. import TabPane from '../TabPane';
  4. const Demo = () => {
  5. const tabPaneList = [
  6. 'a',
  7. 'b',
  8. 'c'
  9. ];
  10. return (
  11. <div>
  12. <Tabs
  13. defaultActiveKey="1"
  14. renderTabBar={(tabBarProps, DefaultTabBar) => {
  15. return (
  16. <div className="tab-bar-box">
  17. 这是二次封装的Tab Bar,当前ActiveKey:{tabBarProps.activeKey}
  18. <DefaultTabBar {...tabBarProps} />
  19. </div>
  20. );
  21. }}
  22. tabPaneMotion>
  23. {
  24. tabPaneList.map((item, index) => {
  25. return (
  26. <TabPane tab={item} itemKey={index.toString()} key={item}>
  27. { item + index }
  28. </TabPane>
  29. );
  30. })
  31. }
  32. </Tabs>
  33. </div>
  34. );
  35. };
  36. export default Demo;