Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
3f78b5aa
提交
3f78b5aa
authored
11月 12, 2020
作者:
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: pageLoading not working
上级
577bf788
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
19 行增加
和
13 行删除
+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
没有找到文件。
src/design/var/index.less
浏览文件 @
3f78b5aa
...
@@ -15,7 +15,5 @@
...
@@ -15,7 +15,5 @@
@side-drag-z-index: 200;
@side-drag-z-index: 200;
@page-loading-z-index: 10000;
@page-loading-z-index: 10000;
// app menu
// left-menu
// left-menu
@app-menu-item-height: 4
2
px;
@app-menu-item-height: 4
6
px;
src/layouts/default/LayoutContent.tsx
浏览文件 @
3f78b5aa
...
@@ -16,7 +16,6 @@ export default defineComponent({
...
@@ -16,7 +16,6 @@ export default defineComponent({
return
()
=>
{
return
()
=>
{
const
{
contentMode
,
openPageLoading
}
=
unref
(
getProjectConfigRef
);
const
{
contentMode
,
openPageLoading
}
=
unref
(
getProjectConfigRef
);
const
{
getPageLoading
}
=
appStore
;
const
{
getPageLoading
}
=
appStore
;
const
wrapClass
=
contentMode
===
ContentEnum
.
FULL
?
'full'
:
'fixed'
;
const
wrapClass
=
contentMode
===
ContentEnum
.
FULL
?
'full'
:
'fixed'
;
return
(
return
(
<
div
class=
{
[
`default-layout__main`
]
}
>
<
div
class=
{
[
`default-layout__main`
]
}
>
...
...
src/layouts/page/index.tsx
浏览文件 @
3f78b5aa
...
@@ -12,9 +12,16 @@ import { appStore } from '/@/store/modules/app';
...
@@ -12,9 +12,16 @@ import { appStore } from '/@/store/modules/app';
export
default
defineComponent
({
export
default
defineComponent
({
name
:
'PageLayout'
,
name
:
'PageLayout'
,
setup
()
{
setup
()
{
const
getProjectConfigRef
=
computed
(()
=>
{
const
getProjectConfigRef
=
computed
(()
=>
appStore
.
getProjectConfig
);
return
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
);
const
{
openPageLoading
}
=
unref
(
getProjectConfigRef
);
let
on
=
{};
let
on
=
{};
...
@@ -27,21 +34,20 @@ export default defineComponent({
...
@@ -27,21 +34,20 @@ export default defineComponent({
const
{
const
{
routerTransition
,
routerTransition
,
openRouterTransition
,
openRouterTransition
,
openKeepAlive
,
multiTabsSetting
:
{
max
},
multiTabsSetting
:
{
show
,
max
},
}
=
unref
(
getProjectConfigRef
);
}
=
unref
(
getProjectConfigRef
);
const
openCache
=
openKeepAlive
&&
show
;
const
cacheTabs
=
toRaw
(
tabStore
.
getKeepAliveTabsState
)
as
string
[];
return
(
return
(
<
div
>
<
div
>
<
RouterView
>
<
RouterView
>
{
{
{
{
default
:
({
Component
,
route
}:
{
Component
:
any
;
route
:
RouteLocation
})
=>
{
default
:
({
Component
,
route
}:
{
Component
:
any
;
route
:
RouteLocation
})
=>
{
// No longer show animations that are already in the tab
// 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
}
>
<
KeepAlive
max=
{
max
}
include=
{
cacheTabs
}
>
<
Component
key=
{
route
.
fullPath
}
/>
<
Component
key=
{
route
.
fullPath
}
/>
</
KeepAlive
>
</
KeepAlive
>
...
...
src/layouts/page/useTransition.ts
浏览文件 @
3f78b5aa
...
@@ -3,6 +3,7 @@ import { tryOnUnmounted } from '/@/utils/helper/vueHelper';
...
@@ -3,6 +3,7 @@ import { tryOnUnmounted } from '/@/utils/helper/vueHelper';
export
function
useTransition
()
{
export
function
useTransition
()
{
function
handleAfterEnter
()
{
function
handleAfterEnter
()
{
const
{
openRouterTransition
,
openPageLoading
}
=
appStore
.
getProjectConfig
;
const
{
openRouterTransition
,
openPageLoading
}
=
appStore
.
getProjectConfig
;
if
(
!
openRouterTransition
||
!
openPageLoading
)
return
;
if
(
!
openRouterTransition
||
!
openPageLoading
)
return
;
// Close loading after the route switching animation ends
// Close loading after the route switching animation ends
appStore
.
setPageLoadingAction
(
false
);
appStore
.
setPageLoadingAction
(
false
);
...
...
src/router/guard/index.ts
浏览文件 @
3f78b5aa
...
@@ -21,6 +21,8 @@ export function createGuard(router: Router) {
...
@@ -21,6 +21,8 @@ export function createGuard(router: Router) {
if
(
removeAllHttpPending
)
{
if
(
removeAllHttpPending
)
{
axiosCanceler
=
new
AxiosCanceler
();
axiosCanceler
=
new
AxiosCanceler
();
}
}
createPageLoadingGuard
(
router
);
router
.
beforeEach
(
async
(
to
)
=>
{
router
.
beforeEach
(
async
(
to
)
=>
{
// Determine whether the tab has been opened
// Determine whether the tab has been opened
const
isOpen
=
getIsOpenTab
(
to
.
fullPath
);
const
isOpen
=
getIsOpenTab
(
to
.
fullPath
);
...
@@ -59,5 +61,4 @@ export function createGuard(router: Router) {
...
@@ -59,5 +61,4 @@ export function createGuard(router: Router) {
openNProgress
&&
createProgressGuard
(
router
);
openNProgress
&&
createProgressGuard
(
router
);
createPermissionGuard
(
router
);
createPermissionGuard
(
router
);
createPageLoadingGuard
(
router
);
}
}
src/router/guard/pageLoadingGuard.ts
浏览文件 @
3f78b5aa
...
@@ -20,6 +20,7 @@ export function createPageLoadingGuard(router: Router) {
...
@@ -20,6 +20,7 @@ export function createPageLoadingGuard(router: Router) {
appStore
.
commitPageLoadingState
(
true
);
appStore
.
commitPageLoadingState
(
true
);
return
true
;
return
true
;
}
}
if
(
show
&&
openKeepAlive
&&
!
isFirstLoad
)
{
if
(
show
&&
openKeepAlive
&&
!
isFirstLoad
)
{
const
tabList
=
tabStore
.
getTabsState
;
const
tabList
=
tabStore
.
getTabsState
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论