Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-layout
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
packages
pro-layout
Commits
7ea945d3
Commit
7ea945d3
authored
Feb 08, 2021
by
言肆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "fix: get isMobile props from RouteContext"
This reverts commit
4d986e46
.
parent
1cbb2b33
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
13 deletions
+6
-13
BasicLayout.tsx
src/BasicLayout.tsx
+1
-3
index.tsx
src/GlobalHeader/index.tsx
+1
-3
Header.tsx
src/Header.tsx
+3
-3
index.tsx
src/SiderMenu/index.tsx
+1
-4
No files found.
src/BasicLayout.tsx
View file @
7ea945d3
...
...
@@ -9,7 +9,6 @@ import { default as Header, HeaderViewProps } from './Header';
import
{
RenderVNodeType
,
WithFalse
}
from
'./typings'
;
import
{
getComponentOrSlot
,
PropRenderType
,
PropTypes
}
from
'./utils'
;
import
'./BasicLayout.less'
;
import
{
useRouteContext
}
from
'./RouteContext'
;
const
defaultI18nRender
=
(
key
:
string
)
=>
key
;
...
...
@@ -61,10 +60,9 @@ const ProLayout: FunctionalComponent<BasicLayoutProps> = (props, { emit, slots }
matchMenuKeys
,
navTheme
,
menuData
,
isMobile
,
// defaultCollapsed,
}
=
props
;
const
routeContext
=
useRouteContext
();
const
{
isMobile
}
=
routeContext
;
const
isTop
=
computed
(()
=>
layout
===
'top'
);
// const isSide = computed(() => layout === 'side');
// const isMix = computed(() => layout === 'mix');
...
...
src/GlobalHeader/index.tsx
View file @
7ea945d3
...
...
@@ -13,7 +13,6 @@ import { clearMenuItem } from '../utils';
import
type
{
HeaderViewProps
}
from
'../Header'
;
import
'./index.less'
;
import
{
useProProvider
}
from
'../ProProvider'
;
import
{
useRouteContext
}
from
'../RouteContext'
;
export
interface
GlobalHeaderProps
extends
Partial
<
PureSettings
>
{
collapsed
?:
boolean
;
...
...
@@ -52,6 +51,7 @@ export const GlobalHeader: FunctionalComponent<GlobalHeaderProps & PrivateSiderM
{
slots
},
)
=>
{
const
{
isMobile
,
logo
,
collapsed
,
onCollapse
,
...
...
@@ -66,8 +66,6 @@ export const GlobalHeader: FunctionalComponent<GlobalHeaderProps & PrivateSiderM
menuData
,
prefixCls
:
customPrefixCls
,
}
=
props
;
const
routeContext
=
useRouteContext
();
const
{
isMobile
}
=
routeContext
;
const
{
getPrefixCls
}
=
useProProvider
();
const
prefixCls
=
customPrefixCls
||
getPrefixCls
();
const
baseClassName
=
computed
(()
=>
`
${
prefixCls
}
-global-header`
);
...
...
src/Header.tsx
View file @
7ea945d3
...
...
@@ -68,6 +68,7 @@ export const HeaderView = defineComponent({
prefixCls
,
headerRender
,
headerContentRender
,
isMobile
,
fixedHeader
,
hasSiderMenu
,
headerHeight
,
...
...
@@ -76,11 +77,10 @@ export const HeaderView = defineComponent({
onCollapse
,
}
=
toRefs
(
props
);
const
context
=
useRouteContext
();
const
{
isMobile
}
=
context
;
const
needFixedHeader
=
computed
(()
=>
fixedHeader
.
value
||
layout
.
value
===
'mix'
);
const
isTop
=
computed
(()
=>
layout
.
value
===
'top'
);
const
needSettingWidth
=
computed
(
()
=>
needFixedHeader
.
value
&&
hasSiderMenu
.
value
&&
!
isTop
.
value
&&
!
isMobile
,
()
=>
needFixedHeader
.
value
&&
hasSiderMenu
.
value
&&
!
isTop
.
value
&&
!
isMobile
.
value
,
);
// cache menu
const
clearMenuData
=
computed
(
...
...
@@ -99,7 +99,7 @@ export const HeaderView = defineComponent({
{
headerContentRender
&&
headerContentRender
.
value
&&
headerContentRender
.
value
(
props
)
}
</
GlobalHeader
>
);
if
(
isTop
.
value
&&
!
isMobile
)
{
if
(
isTop
.
value
&&
!
isMobile
.
value
)
{
defaultDom
=
(
<
TopNavHeader
theme=
{
navTheme
.
value
as
'light'
|
'dark'
}
...
...
src/SiderMenu/index.tsx
View file @
7ea945d3
...
...
@@ -4,14 +4,11 @@ import 'ant-design-vue/es/drawer/style';
import
Drawer
from
'ant-design-vue/es/drawer'
;
import
SiderMenu
,
{
SiderMenuProps
,
PrivateSiderMenuProps
}
from
'./SiderMenu'
;
import
{
useRouteContext
}
from
'../RouteContext'
;
export
type
SiderMenuWrapperProps
=
SiderMenuProps
&
Partial
<
PrivateSiderMenuProps
>
;
const
SiderMenuWrapper
:
FunctionalComponent
<
SiderMenuWrapperProps
>
=
props
=>
{
const
routeContext
=
useRouteContext
();
const
{
isMobile
}
=
routeContext
;
return
isMobile
?
(
return
props
.
isMobile
?
(
<
Drawer
>
<
SiderMenu
{
...
props
}
/>
</
Drawer
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment