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
3f78b5aa
Commit
3f78b5aa
authored
Nov 12, 2020
by
vben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: pageLoading not working
parent
577bf788
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
13 deletions
+19
-13
index.less
src/design/var/index.less
+1
-3
LayoutContent.tsx
src/layouts/default/LayoutContent.tsx
+0
-1
index.tsx
src/layouts/page/index.tsx
+14
-8
useTransition.ts
src/layouts/page/useTransition.ts
+1
-0
index.ts
src/router/guard/index.ts
+2
-1
pageLoadingGuard.ts
src/router/guard/pageLoadingGuard.ts
+1
-0
No files found.
src/design/var/index.less
View file @
3f78b5aa
...
...
@@ -15,7 +15,5 @@
@side-drag-z-index: 200;
@page-loading-z-index: 10000;
// app menu
// left-menu
@app-menu-item-height: 4
2
px;
@app-menu-item-height: 4
6
px;
src/layouts/default/LayoutContent.tsx
View file @
3f78b5aa
...
...
@@ -16,7 +16,6 @@ export default defineComponent({
return
()
=>
{
const
{
contentMode
,
openPageLoading
}
=
unref
(
getProjectConfigRef
);
const
{
getPageLoading
}
=
appStore
;
const
wrapClass
=
contentMode
===
ContentEnum
.
FULL
?
'
full
'
:
'
fixed
'
;
return
(
<
div
class=
{
[
`default-layout__main`
]
}
>
...
...
src/layouts/page/index.tsx
View file @
3f78b5aa
...
...
@@ -12,9 +12,16 @@ import { appStore } from '/@/store/modules/app';
export
default
defineComponent
({
name
:
'
PageLayout
'
,
setup
()
{
const
getProjectConfigRef
=
computed
(()
=>
{
return
appStore
.
getProjectConfig
;
const
getProjectConfigRef
=
computed
(()
=>
appStore
.
getProjectConfig
);
const
openCacheRef
=
computed
(()
=>
{
const
{
openKeepAlive
,
multiTabsSetting
:
{
show
},
}
=
unref
(
getProjectConfigRef
);
return
openKeepAlive
&&
show
;
});
const
getCacheTabsRef
=
computed
(()
=>
toRaw
(
tabStore
.
getKeepAliveTabsState
)
as
string
[]);
const
{
openPageLoading
}
=
unref
(
getProjectConfigRef
);
let
on
=
{};
...
...
@@ -27,21 +34,20 @@ export default defineComponent({
const
{
routerTransition
,
openRouterTransition
,
openKeepAlive
,
multiTabsSetting
:
{
show
,
max
},
multiTabsSetting
:
{
max
},
}
=
unref
(
getProjectConfigRef
);
const
openCache
=
openKeepAlive
&&
show
;
const
cacheTabs
=
toRaw
(
tabStore
.
getKeepAliveTabsState
)
as
string
[];
return
(
<
div
>
<
RouterView
>
{
{
default
:
({
Component
,
route
}:
{
Component
:
any
;
route
:
RouteLocation
})
=>
{
// No longer show animations that are already in the tab
const
name
=
route
.
meta
.
inTab
?
'
fade
'
:
null
;
const
cacheTabs
=
unref
(
getCacheTabsRef
);
const
isInCache
=
cacheTabs
.
includes
(
route
.
name
as
string
);
const
name
=
isInCache
&&
route
.
meta
.
inTab
?
'
fade
'
:
null
;
const
Content
=
openCache
?
(
const
Content
=
unref
(
openCacheRef
)
?
(
<
KeepAlive
max=
{
max
}
include=
{
cacheTabs
}
>
<
Component
key=
{
route
.
fullPath
}
/>
</
KeepAlive
>
...
...
src/layouts/page/useTransition.ts
View file @
3f78b5aa
...
...
@@ -3,6 +3,7 @@ import { tryOnUnmounted } from '/@/utils/helper/vueHelper';
export
function
useTransition
()
{
function
handleAfterEnter
()
{
const
{
openRouterTransition
,
openPageLoading
}
=
appStore
.
getProjectConfig
;
if
(
!
openRouterTransition
||
!
openPageLoading
)
return
;
// Close loading after the route switching animation ends
appStore
.
setPageLoadingAction
(
false
);
...
...
src/router/guard/index.ts
View file @
3f78b5aa
...
...
@@ -21,6 +21,8 @@ export function createGuard(router: Router) {
if
(
removeAllHttpPending
)
{
axiosCanceler
=
new
AxiosCanceler
();
}
createPageLoadingGuard
(
router
);
router
.
beforeEach
(
async
(
to
)
=>
{
// Determine whether the tab has been opened
const
isOpen
=
getIsOpenTab
(
to
.
fullPath
);
...
...
@@ -59,5 +61,4 @@ export function createGuard(router: Router) {
openNProgress
&&
createProgressGuard
(
router
);
createPermissionGuard
(
router
);
createPageLoadingGuard
(
router
);
}
src/router/guard/pageLoadingGuard.ts
View file @
3f78b5aa
...
...
@@ -20,6 +20,7 @@ export function createPageLoadingGuard(router: Router) {
appStore
.
commitPageLoadingState
(
true
);
return
true
;
}
if
(
show
&&
openKeepAlive
&&
!
isFirstLoad
)
{
const
tabList
=
tabStore
.
getTabsState
;
...
...
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