Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 40 additions & 36 deletions src/pages/layout/proTabs/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ const ProTabs = (props) => {
const fullPath = pathname + search

const {
token: { colorBgContainer },
token: { colorBgContainer }
} = theme.useToken()

const renderTabBar = (props, DefaultTabBar) => (
<StickyBox offsetTop={0} style={{ zIndex: 10 }}>
<DefaultTabBar key={nanoid()} {...props} className="pro-tabs" style={{ background: colorBgContainer }} />
<DefaultTabBar key={nanoid()} {...props} className='pro-tabs' style={{ background: colorBgContainer }} />
</StickyBox>
)

useEffect(() => {
document.querySelector('#container').scrollTo({
top: 0,
left: 0,
behavior: 'smooth',
behavior: 'smooth'
})
}, [pathname])

Expand Down Expand Up @@ -106,12 +106,12 @@ const ProTabs = (props) => {
const tabRightMenu = [
{
label: '关闭其他',
key: 'other',
key: 'other'
},
{
label: '全部关闭',
key: 'all',
},
key: 'all'
}
]

const fixError = () => {
Expand All @@ -121,48 +121,50 @@ const ProTabs = (props) => {
return (
<Tabs
hideAdd
type="editable-card"
type='editable-card'
onChange={onChange}
onTabClick={onTabClick}
onTabScroll={onTabScroll}
onEdit={onEdit}
renderTabBar={renderTabBar}
className="layout-container"
id="container"
className='layout-container'
id='container'
tabBarStyle={{
zIndex: 2,
marginBottom: 0,
marginBottom: 0
}}
activeKey={activeKey}
destroyOnHidden={false}
tabBarExtraContent={{
left: (
<Space align="center" size={30} style={{ margin: '0 25px' }}>
<Space align='center' size={30} style={{ margin: '0 25px' }}>
<FireOutlined style={{ color: '#eb2f96', fontSize: 16 }} />
</Space>
),
right: (
<>
<Space style={{ padding: '0 5px' }}>
<Fullscreen ele="#fullScreenContent" placement="left" tips="主内容全屏" />
<Fullscreen ele='#fullScreenContent' placement='left' tips='主内容全屏' />
</Space>
{panes.length > 2 ? (
<Dropdown
menu={{
items: tabRightMenu,
onClick: ({ key }) => {
onTabContextMenu(key)
},
}}
trigger={['hover']}
>
<Button type="link">
More <DownOutlined />
</Button>
</Dropdown>
) : null}
{panes.length > 2
? (
<Dropdown
menu={{
items: tabRightMenu,
onClick: ({ key }) => {
onTabContextMenu(key)
}
}}
trigger={['hover']}
>
<Button type='link'>
More <DownOutlined />
</Button>
</Dropdown>
)
: null}
</>
),
)
}}
items={panes.map((pane) => ({
label: (
Expand All @@ -171,7 +173,7 @@ const ProTabs = (props) => {
<SyncOutlined
style={{ padding: '0 5px', display: 'line-block' }}
onClick={refreshTab}
title="刷新"
title='刷新'
spin={isReload}
/>
)}
Expand All @@ -183,15 +185,17 @@ const ProTabs = (props) => {
forceRender: true,
children: (
<MyErrorBoundary fixError={fixError}>
<div className="layout-tabpanel">
{isReload && pane.key === fullPath && pane.key !== '/404' ? (
<Loading tip="刷新中..." />
) : (
<>{pane.content}</>
)}
<div className='layout-tabpanel'>
{isReload && pane.key === fullPath && pane.key !== '/404'
? (
<Loading tip='刷新中...' />
)
: (
<>{pane.content}</>
)}
</div>
</MyErrorBoundary>
),
)
}))}
/>
)
Expand Down
Loading