Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
najiu-frontend
najiu-admin-template
Commits
f81c4019
Commit
f81c4019
authored
Dec 13, 2020
by
vben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf(tabs): perf multiple-tabs
parent
27e50b47
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
95 deletions
+3
-95
index.less
src/layouts/default/index.less
+0
-17
index.tsx
src/layouts/default/index.tsx
+0
-75
useLayoutContext.ts
src/layouts/default/useLayoutContext.ts
+3
-3
No files found.
src/layouts/default/index.less
deleted
100644 → 0
View file @
27e50b47
@import (reference) '../../design/index.less';
.default-layout {
display: flex;
width: 100%;
min-height: 100%;
background: @content-bg;
flex-direction: column;
> .ant-layout {
min-height: 100%;
}
&__main {
margin-left: 1px;
}
}
src/layouts/default/index.tsx
deleted
100644 → 0
View file @
27e50b47
import
'
./index.less
'
;
import
{
defineComponent
,
unref
,
ref
}
from
'
vue
'
;
import
{
Layout
}
from
'
ant-design-vue
'
;
import
{
createAsyncComponent
}
from
'
/@/utils/factory/createAsyncComponent
'
;
import
LayoutHeader
from
'
./header/LayoutHeader
'
;
import
LayoutContent
from
'
./content/index.vue
'
;
import
LayoutSideBar
from
'
./sider
'
;
import
LayoutMultipleHeader
from
'
./header/LayoutMultipleHeader
'
;
import
{
useHeaderSetting
}
from
'
/@/hooks/setting/useHeaderSetting
'
;
import
{
useMenuSetting
}
from
'
/@/hooks/setting/useMenuSetting
'
;
import
{
createLayoutContext
}
from
'
./useLayoutContext
'
;
import
{
registerGlobComp
}
from
'
/@/components/registerGlobComp
'
;
import
{
createBreakpointListen
}
from
'
/@/hooks/event/useBreakpoint
'
;
import
{
isMobile
}
from
'
/@/utils/is
'
;
const
LayoutFeatures
=
createAsyncComponent
(()
=>
import
(
'
/@/layouts/default/feature/index.vue
'
));
const
LayoutFooter
=
createAsyncComponent
(()
=>
import
(
'
/@/layouts/default/footer/index.vue
'
));
export
default
defineComponent
({
name
:
'
DefaultLayout
'
,
setup
()
{
const
headerRef
=
ref
<
ComponentRef
>
(
null
);
const
isMobileRef
=
ref
(
false
);
createLayoutContext
({
fullHeader
:
headerRef
,
isMobile
:
isMobileRef
});
createBreakpointListen
(()
=>
{
isMobileRef
.
value
=
isMobile
();
});
// ! Only register global components here
// ! Can reduce the size of the first screen code
// default layout It is loaded after login. So it won’t be packaged to the first screen
registerGlobComp
();
const
{
getShowFullHeaderRef
}
=
useHeaderSetting
();
const
{
getShowSidebar
}
=
useMenuSetting
();
return
()
=>
{
return
(
<
Layout
class=
"default-layout"
>
{
()
=>
(
<>
<
LayoutFeatures
/>
{
unref
(
getShowFullHeaderRef
)
&&
<
LayoutHeader
fixed=
{
true
}
ref=
{
headerRef
}
/>
}
<
Layout
>
{
()
=>
(
<>
{
unref
(
getShowSidebar
)
&&
<
LayoutSideBar
/>
}
<
Layout
class=
"default-layout__main"
>
{
()
=>
(
<>
<
LayoutMultipleHeader
/>
<
LayoutContent
/>
<
LayoutFooter
/>
</>
)
}
</
Layout
>
</>
)
}
</
Layout
>
</>
)
}
</
Layout
>
);
};
},
});
src/layouts/default/useLayoutContext.ts
View file @
f81c4019
...
...
@@ -6,12 +6,12 @@ export interface LayoutContextProps {
isMobile
:
Ref
<
boolean
>
;
}
const
layoutContextInjectK
ey
:
InjectionKey
<
LayoutContextProps
>
=
Symbol
();
const
k
ey
:
InjectionKey
<
LayoutContextProps
>
=
Symbol
();
export
function
createLayoutContext
(
context
:
LayoutContextProps
)
{
return
createContext
<
LayoutContextProps
>
(
context
,
layoutContextInjectK
ey
);
return
createContext
<
LayoutContextProps
>
(
context
,
k
ey
);
}
export
function
useLayoutContext
()
{
return
useContext
<
LayoutContextProps
>
(
layoutContextInjectK
ey
);
return
useContext
<
LayoutContextProps
>
(
k
ey
);
}
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