Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format code with prettier and standardjs #135

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions src/pages/layout/proContent/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ const ProContent = () => {
content: null,
key: '',
closable: false,
path: '',
path: ''
})

const pathRef = useRef('')
const { pathname, search } = useLocation()
const {
token: { colorBgContainer, colorBgLayout },
token: { colorBgContainer, colorBgLayout }
} = theme.useToken()
useEffect(() => {
const { tabKey, title, element } = getKeyName(pathname)
Expand All @@ -36,21 +36,21 @@ const ProContent = () => {
content: element,
key: tabKey,
closable: tabKey !== '/',
path: newPath,
path: newPath
})
setTabActiveKey(tabKey)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [pathname, search, panes, activeKey])

return (
<Layout className={styles.layout}>
<Header className="layout-header" style={{ background: colorBgLayout }}>
<Header className='layout-header' style={{ background: colorBgLayout }}>
<ProBreadcrumb />
</Header>
<Content className="layout-content" id="fullScreen" style={{ background: colorBgContainer }}>
<Content className='layout-content' id='fullScreen' style={{ background: colorBgContainer }}>
<ProTabs panesItem={panesItem} tabActiveKey={tabActiveKey} />
</Content>
<Footer className="layout-footer">
<Footer className='layout-footer'>
<FloatButton.BackTop target={() => document.querySelector('#container')}>
<VerticalAlignTopOutlined style={{ fontSize: 20 }} />
</FloatButton.BackTop>
Expand Down
74 changes: 39 additions & 35 deletions src/pages/layout/proTabs/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ProTabs = (props) => {
const fullPath = pathname + search

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

const renderTabBar = (_props, DefaultTabBar) => (
Expand All @@ -31,7 +31,7 @@ const ProTabs = (props) => {
<DefaultTabBar
key={nanoid()}
{..._props}
className="pro-tabs"
className='pro-tabs'
style={{ ...style, background: colorBgContainer }}
/>
)}
Expand All @@ -42,7 +42,7 @@ const ProTabs = (props) => {
document.querySelector('#container').scrollTo({
top: 0,
left: 0,
behavior: 'smooth',
behavior: 'smooth'
})
}, [pathname])

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

const fixError = () => {
refreshTab()
}

return (
<StickyContainer className="layout-container" id="container">
<StickyContainer className='layout-container' id='container'>
<Tabs
hideAdd
type="editable-card"
type='editable-card'
onChange={onChange}
onTabClick={onTabClick}
onTabScroll={onTabScroll}
onEdit={onEdit}
renderTabBar={renderTabBar}
tabBarStyle={{
zIndex: 2,
zIndex: 2
}}
activeKey={activeKey}
destroyInactiveTabPane={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: (
<>
<Fullscreen ele="#fullScreen" placement="left" tips="主内容全屏" />
{panes.length > 2 ? (
<Dropdown
menu={{
items: tabRightMenu,
onClick: ({ key }) => {
onTabContextMenu(key)
},
}}
trigger={['hover']}
>
<Button type="link">
More <DownOutlined />
</Button>
</Dropdown>
) : null}
<Fullscreen ele='#fullScreen' placement='left' tips='主内容全屏' />
{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: (
<>
{pane.key === fullPath && pane.key !== '/404' && (
<SyncOutlined onClick={refreshTab} title="刷新" spin={isReload} />
<SyncOutlined onClick={refreshTab} title='刷新' spin={isReload} />
)}
{pane.title}
</>
Expand All @@ -181,15 +183,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>
),
)
}))}
/>
</StickyContainer>
Expand Down