Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
a7a8b894
提交
a7a8b894
authored
1月 04, 2021
作者:
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(transition): fix transition not work
上级
da76f3c7
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
78 行增加
和
23 行删除
+78
-23
index.ts
src/components/Loading/index.ts
+5
-2
useTable.ts
src/components/Table/src/hooks/useTable.ts
+1
-0
index.vue
src/layouts/default/content/index.vue
+0
-1
index.vue
src/layouts/iframe/index.vue
+9
-3
ParentView.vue
src/layouts/page/ParentView.vue
+20
-4
index.tsx
src/layouts/page/index.tsx
+13
-12
transition.ts
src/layouts/page/transition.ts
+29
-0
index.ts
src/router/guard/index.ts
+1
-1
没有找到文件。
src/components/Loading/index.ts
浏览文件 @
a7a8b894
import
{
createAsyncComponent
}
from
'/@/utils/factory/createAsyncComponent'
;
export
const
Loading
=
createAsyncComponent
(()
=>
import
(
'./src/index.vue'
));
//
import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
//
export const Loading = createAsyncComponent(() => import('./src/index.vue'));
import
Loading
from
'./src/index.vue'
;
export
{
Loading
};
export
{
useLoading
}
from
'./src/useLoading'
;
export
{
createLoading
}
from
'./src/createLoading'
;
src/components/Table/src/hooks/useTable.ts
浏览文件 @
a7a8b894
...
...
@@ -42,6 +42,7 @@ export function useTable(
},
{
immediate
:
true
,
deep
:
true
,
}
);
}
...
...
src/layouts/default/content/index.vue
浏览文件 @
a7a8b894
...
...
@@ -28,7 +28,6 @@
const
{
prefixCls
}
=
useDesign
(
'layout-content'
);
const
{
getOpenPageLoading
}
=
useTransitionSetting
();
const
{
getLayoutContentMode
,
getPageLoading
}
=
useRootSetting
();
return
{
prefixCls
,
getOpenPageLoading
,
...
...
src/layouts/iframe/index.vue
浏览文件 @
a7a8b894
<
template
>
<div>
<div
v-if=
"showFrame"
>
<template
v-for=
"frame in getFramePages"
:key=
"frame.path"
>
<FramePage
v-if=
"frame.meta.frameSrc && hasRenderFrame(frame.name)"
...
...
@@ -10,7 +10,7 @@
</div>
</template>
<
script
lang=
"ts"
>
import
{
defineComponent
}
from
'vue'
;
import
{
defineComponent
,
unref
,
computed
}
from
'vue'
;
import
FramePage
from
'/@/views/sys/iframe/index.vue'
;
import
{
useFrameKeepAlive
}
from
'./useFrameKeepAlive'
;
...
...
@@ -19,7 +19,13 @@
name
:
'FrameLayout'
,
components
:
{
FramePage
},
setup
()
{
return
{
...
useFrameKeepAlive
()
};
const
{
getFramePages
,
hasRenderFrame
,
showIframe
}
=
useFrameKeepAlive
();
const
showFrame
=
computed
(()
=>
{
return
unref
(
getFramePages
).
length
>
0
;
});
return
{
getFramePages
,
hasRenderFrame
,
showIframe
,
showFrame
};
},
});
</
script
>
src/layouts/page/ParentView.vue
浏览文件 @
a7a8b894
...
...
@@ -5,10 +5,24 @@
<div>
<router-view>
<template
v-slot=
"
{ Component, route }">
<keep-alive
v-if=
"openCache"
:include=
"getCaches"
>
<component
:is=
"Component"
:key=
"route.fullPath"
/>
</keep-alive>
<component
v-else
:is=
"Component"
:key=
"route.fullPath"
/>
<transition
:name=
"
getTransitionName(
{
route,
openCache: openCache,
enableTransition: getEnableTransition,
cacheTabs: getCaches,
def: getBasicTransition,
})
"
mode="out-in"
appear
>
<keep-alive
v-if=
"openCache"
:include=
"getCaches"
>
<component
:is=
"Component"
:key=
"route.fullPath"
/>
</keep-alive>
<component
v-else
:is=
"Component"
:key=
"route.fullPath"
/>
</transition>
</
template
>
</router-view>
</div>
...
...
@@ -21,6 +35,7 @@
import
{
useTransitionSetting
}
from
'/@/hooks/setting/useTransitionSetting'
;
import
{
useCache
}
from
'./useCache'
;
import
{
getTransitionName
}
from
'./transition'
;
export
default
defineComponent
({
parentView
:
true
,
...
...
@@ -40,6 +55,7 @@
getBasicTransition
,
openCache
,
getEnableTransition
,
getTransitionName
,
};
},
});
...
...
src/layouts/page/index.tsx
浏览文件 @
a7a8b894
import
type
{
FunctionalComponent
}
from
'vue'
;
import
type
{
DefaultContext
}
from
'./transition'
;
import
{
computed
,
defineComponent
,
unref
,
Transition
,
KeepAlive
}
from
'vue'
;
import
{
RouterView
,
RouteLocation
}
from
'vue-router'
;
...
...
@@ -10,6 +11,7 @@ import { useRootSetting } from '/@/hooks/setting/useRootSetting';
import
{
useTransitionSetting
}
from
'/@/hooks/setting/useTransitionSetting'
;
import
{
useCache
}
from
'./useCache'
;
import
{
useMultipleTabSetting
}
from
'/@/hooks/setting/useMultipleTabSetting'
;
import
{
getTransitionName
}
from
'./transition'
;
// import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
interface
DefaultContext
{
...
...
@@ -32,17 +34,20 @@ export default defineComponent({
return
()
=>
{
return
(
<
div
>
<>
<
RouterView
>
{
{
default
:
({
Component
,
route
}:
DefaultContext
)
=>
{
// No longer show animations that are already in the tab
const
cacheTabs
=
unref
(
getCaches
);
const
isInCache
=
cacheTabs
.
includes
(
route
.
name
as
string
);
const
name
=
isInCache
&&
route
.
meta
.
loaded
&&
unref
(
getEnableTransition
)
?
'fade-slide'
:
null
;
const
name
=
getTransitionName
({
route
,
openCache
:
unref
(
openCache
),
enableTransition
:
unref
(
getEnableTransition
),
cacheTabs
,
def
:
unref
(
getBasicTransition
),
});
// When the child element is the parentView, adding the key will cause the component to be executed multiple times. When it is not parentView, you need to add a key, because it needs to be compatible with the same route carrying different parameters
const
isParentView
=
Component
?.
type
.
parentView
;
...
...
@@ -60,11 +65,7 @@ export default defineComponent({
return
PageContent
;
}
return
(
<
Transition
name=
{
name
||
route
.
meta
.
transitionName
||
unref
(
getBasicTransition
)
}
mode=
"out-in"
appear=
{
true
}
>
<
Transition
name=
{
name
}
mode=
"out-in"
appear=
{
true
}
>
{
()
=>
PageContent
}
</
Transition
>
);
...
...
@@ -72,7 +73,7 @@ export default defineComponent({
}
}
</
RouterView
>
{
unref
(
getCanEmbedIFramePage
)
&&
<
FrameLayout
/>
}
</
div
>
</>
);
};
},
...
...
src/layouts/page/transition.ts
0 → 100644
浏览文件 @
a7a8b894
import
type
{
FunctionalComponent
}
from
'vue'
;
import
type
{
RouteLocation
}
from
'vue-router'
;
export
interface
DefaultContext
{
Component
:
FunctionalComponent
&
{
type
:
Indexable
};
route
:
RouteLocation
;
}
export
function
getTransitionName
({
route
,
openCache
,
cacheTabs
,
enableTransition
,
def
,
}:
Pick
<
DefaultContext
,
'route'
>
&
{
enableTransition
:
boolean
;
openCache
:
boolean
;
def
:
string
;
cacheTabs
:
string
[];
})
{
const
isInCache
=
cacheTabs
.
includes
(
route
.
name
as
string
);
const
transitionName
=
'fade-slide'
;
let
name
:
string
|
null
=
transitionName
;
if
(
openCache
)
{
name
=
isInCache
&&
route
.
meta
.
loaded
&&
enableTransition
?
transitionName
:
null
;
}
return
name
||
route
.
meta
.
transitionName
||
def
;
}
src/router/guard/index.ts
浏览文件 @
a7a8b894
...
...
@@ -11,11 +11,11 @@ import { createPageGuard } from './pageGuard';
export
function
createGuard
(
router
:
Router
)
{
createPageGuard
(
router
);
createPageLoadingGuard
(
router
);
createHttpGuard
(
router
);
createScrollGuard
(
router
);
createMessageGuard
(
router
);
createTitleGuard
(
router
);
createPageLoadingGuard
(
router
);
createProgressGuard
(
router
);
createPermissionGuard
(
router
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论