Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
一臭打代码的 aka 潘先生です
vue-vben-admin
提交
3f78b5aa
V
vue-vben-admin
项目概览
一臭打代码的 aka 潘先生です
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3f78b5aa
编写于
11月 12, 2020
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: pageLoading not working
上级
577bf788
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
19 addition
and
13 deletion
+19
-13
src/design/var/index.less
src/design/var/index.less
+1
-3
src/layouts/default/LayoutContent.tsx
src/layouts/default/LayoutContent.tsx
+0
-1
src/layouts/page/index.tsx
src/layouts/page/index.tsx
+14
-8
src/layouts/page/useTransition.ts
src/layouts/page/useTransition.ts
+1
-0
src/router/guard/index.ts
src/router/guard/index.ts
+2
-1
src/router/guard/pageLoadingGuard.ts
src/router/guard/pageLoadingGuard.ts
+1
-0
未找到文件。
src/design/var/index.less
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
3f78b5aa
...
...
@@ -20,6 +20,7 @@ export function createPageLoadingGuard(router: Router) {
appStore
.
commitPageLoadingState
(
true
);
return
true
;
}
if
(
show
&&
openKeepAlive
&&
!
isFirstLoad
)
{
const
tabList
=
tabStore
.
getTabsState
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录