cjd-parkball
Version:
> 中后台业务组件库,中后台就像公园,进入需要买门票(登录),所以以 Parkball(公园球) 命名,公园内必定捕获!作为一个组件库,提供使用方法文档,方便开发者的调用
39 lines (30 loc) • 875 B
Markdown
---
category: 2
title: 自定义页签头
title_en: Customized bar of tab
---
zh-CN
使用 react-sticky 组件实现吸顶效果。
en-US
use react-sticky.
````jsx
import { Tabs } from 'parkball';
import { StickyContainer, Sticky } from 'react-sticky';
const TabPane = Tabs.TabPane;
const renderTabBar = (props, DefaultTabBar) => (
<Sticky bottomOffset={80}>
{({ style }) => (
<DefaultTabBar {...props} style={{ ...style, zIndex: 1, background: '#fff' }} />
)}
</Sticky>
);
ReactDOM.render(
<StickyContainer>
<Tabs defaultActiveKey="1" renderTabBar={renderTabBar}>
<TabPane tab="Tab 1" key="1" style={{ height: 200 }}>Content of Tab Pane 1</TabPane>
<TabPane tab="Tab 2" key="2">Content of Tab Pane 2</TabPane>
<TabPane tab="Tab 3" key="3">Content of Tab Pane 3</TabPane>
</Tabs>
</StickyContainer>,
mountNode);
````