Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jxf111348
vue-vben-admin
提交
beb4c3a3
V
vue-vben-admin
项目概览
jxf111348
/
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,发现更多精彩内容 >>
提交
beb4c3a3
编写于
10月 13, 2020
作者:
N
nebv
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix routing switch, tab is not activated
上级
177010bf
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
42 addition
and
26 deletion
+42
-26
src/components/Menu/src/BasicMenu.tsx
src/components/Menu/src/BasicMenu.tsx
+7
-8
src/hooks/web/usePage.ts
src/hooks/web/usePage.ts
+1
-0
src/hooks/web/useTabs.ts
src/hooks/web/useTabs.ts
+7
-3
src/layouts/Logo.vue
src/layouts/Logo.vue
+2
-2
src/layouts/default/LayoutMenu.tsx
src/layouts/default/LayoutMenu.tsx
+1
-1
src/layouts/default/index.less
src/layouts/default/index.less
+1
-1
src/layouts/default/multitabs/index.tsx
src/layouts/default/multitabs/index.tsx
+22
-10
src/settings/projectSetting.ts
src/settings/projectSetting.ts
+1
-1
未找到文件。
src/components/Menu/src/BasicMenu.tsx
浏览文件 @
beb4c3a3
...
...
@@ -239,14 +239,13 @@ export default defineComponent({
)
:
(
<
section
class
=
{
`basic-menu-wrap`
}
>
{
getSlot
(
slots
,
'
header
'
)
}
{
props
.
search
&&
(
<
SearchInput
theme
=
{
props
.
theme
}
onChange
=
{
handleInputChange
}
onClick
=
{
handleInputClick
}
collapsed
=
{
getCollapsedState
}
/>
)
}
<
SearchInput
class
=
{
!
props
.
search
?
'
hidden
'
:
''
}
theme
=
{
props
.
theme
}
onChange
=
{
handleInputChange
}
onClick
=
{
handleInputClick
}
collapsed
=
{
getCollapsedState
}
/>
<
section
style
=
{
unref
(
getMenuWrapStyle
)
}
>
<
ScrollContainer
>
{
()
=>
renderMenu
()
}
</
ScrollContainer
>
</
section
>
...
...
src/hooks/web/usePage.ts
浏览文件 @
beb4c3a3
...
...
@@ -10,6 +10,7 @@ export type RouteLocationRawEx = Omit<RouteLocationRaw, 'path'> & { path: PageEn
function
handleError
(
e
:
Error
)
{
console
.
error
(
e
);
// 101是为了 大于 打开时候设置的100延时防止闪动
setTimeout
(()
=>
{
appStore
.
commitPageLoadingState
(
false
);
},
101
);
...
...
src/hooks/web/useTabs.ts
浏览文件 @
beb4c3a3
...
...
@@ -3,6 +3,9 @@ import { PageEnum } from '/@/enums/pageEnum';
import
{
TabItem
,
tabStore
}
from
'
/@/store/modules/tab
'
;
import
{
appStore
}
from
'
/@/store/modules/app
'
;
import
router
from
'
/@/router
'
;
import
{
ref
}
from
'
vue
'
;
const
activeKeyRef
=
ref
<
string
>
(
''
);
type
Fn
=
()
=>
void
;
type
RouteFn
=
(
tabItem
:
TabItem
)
=>
void
;
...
...
@@ -70,12 +73,13 @@ export function useTabs() {
closeOther
:
()
=>
canIUseFn
()
&&
closeOther
(
tabStore
.
getCurrentTab
),
closeCurrent
:
()
=>
canIUseFn
()
&&
closeCurrent
(
tabStore
.
getCurrentTab
),
resetCache
:
()
=>
canIUseFn
()
&&
resetCache
(),
addTab
:
(
path
:
PageEnum
,
goTo
=
false
)
=>
{
addTab
:
(
path
:
PageEnum
,
goTo
=
false
,
replace
=
false
)
=>
{
useTimeout
(()
=>
{
tabStore
.
addTabByPathAction
(
path
);
},
0
);
goTo
&&
router
.
push
(
path
);
activeKeyRef
.
value
=
path
;
goTo
&&
r
eplace
?
router
.
replace
:
r
outer
.
push
(
path
);
},
activeKeyRef
,
};
}
src/layouts/Logo.vue
浏览文件 @
beb4c3a3
<
template
>
<div
class=
"app-logo"
@
click=
"handleGoHome"
>
<img
:src=
"logo"
/>
<div
v-if=
"show"
class=
"logo-title ml-
2
ellipsis"
>
{{
globSetting
.
title
}}
</div>
<div
v-if=
"show"
class=
"logo-title ml-
1
ellipsis"
>
{{
globSetting
.
title
}}
</div>
</div>
</
template
>
<
script
lang=
"ts"
>
...
...
@@ -62,7 +62,7 @@
.logo-title {
display: none;
font-family: Georgia, serif;
font-size: 1
8
px;
font-size: 1
6
px;
.respond-to(medium,{
display: block;
});
...
...
src/layouts/default/LayoutMenu.tsx
浏览文件 @
beb4c3a3
...
...
@@ -193,7 +193,7 @@ export default defineComponent({
class
=
"layout-menu"
theme
=
{
themeData
}
showLogo
=
{
isShowLogo
}
search
=
{
unref
(
showSearchRef
)
}
search
=
{
unref
(
showSearchRef
)
&&
!
collapsed
}
items
=
{
unref
(
menusRef
)
}
flatItems
=
{
unref
(
flatMenusRef
)
}
onClickSearchInput
=
{
handleClickSearchInput
}
...
...
src/layouts/default/index.less
浏览文件 @
beb4c3a3
...
...
@@ -48,7 +48,7 @@
.layout-menu {
&__logo {
height: @header-height;
padding: 10px;
padding: 10px
4px
;
img {
width: @logo-width;
...
...
src/layouts/default/multitabs/index.tsx
浏览文件 @
beb4c3a3
...
...
@@ -2,7 +2,14 @@ import type { TabContentProps } from './tab.data';
import
type
{
TabItem
}
from
'
/@/store/modules/tab
'
;
import
type
{
AppRouteRecordRaw
}
from
'
/@/router/types
'
;
import
{
defineComponent
,
watch
,
computed
,
ref
,
unref
,
onMounted
}
from
'
vue
'
;
import
{
defineComponent
,
watch
,
computed
,
// ref,
unref
,
onMounted
,
}
from
'
vue
'
;
import
{
Tabs
}
from
'
ant-design-vue
'
;
import
TabContent
from
'
./TabContent
'
;
...
...
@@ -12,41 +19,43 @@ import { TabContentEnum } from './tab.data';
import
{
useRouter
}
from
'
vue-router
'
;
import
'
./index.less
'
;
import
{
tabStore
}
from
'
/@/store/modules/tab
'
;
import
{
closeTab
}
from
'
./useTabDropdown
'
;
import
router
from
'
/@/router
'
;
import
{
useTabs
}
from
'
/@/hooks/web/useTabs
'
;
import
{
PageEnum
}
from
'
/@/enums/pageEnum
'
;
import
'
./index.less
'
;
export
default
defineComponent
({
name
:
'
MultiTabs
'
,
setup
()
{
let
isAddAffix
=
false
;
const
go
=
useGo
();
const
{
currentRoute
}
=
useRouter
();
const
{
addTab
,
activeKeyRef
}
=
useTabs
();
onMounted
(()
=>
{
const
{
addTab
}
=
useTabs
();
addTab
(
unref
(
currentRoute
).
path
as
PageEnum
);
});
// 当前激活tab
const
activeKeyRef
=
ref
<
string
>
(
''
);
// const activeKeyRef = ref<string>('');
// 当前tab列表
const
getTabsState
=
computed
(()
=>
{
return
tabStore
.
getTabsState
;
});
if
(
!
isAddAffix
)
{
addAffixTabs
();
isAddAffix
=
true
;
}
watch
(
()
=>
unref
(
currentRoute
).
path
,
(
path
)
=>
{
if
(
!
isAddAffix
)
{
addAffixTabs
();
isAddAffix
=
true
;
if
(
activeKeyRef
.
value
!==
path
)
{
activeKeyRef
.
value
=
path
;
}
activeKeyRef
.
value
=
path
;
// 监听路由的话虽然可以,但是路由切换的时间会造成卡顿现象?
// 使用useTab的addTab的话,当用户手动调转,需要自行调用addTab
// tabStore.commitAddTab((unref(currentRoute) as unknown) as AppRouteRecordRaw);
...
...
@@ -55,6 +64,7 @@ export default defineComponent({
immediate
:
true
,
}
);
/**
* @description: 过滤所有固定路由
*/
...
...
@@ -72,6 +82,7 @@ export default defineComponent({
});
return
tabs
;
}
/**
* @description: 设置固定tabs
*/
...
...
@@ -87,6 +98,7 @@ export default defineComponent({
activeKeyRef
.
value
=
activeKey
;
go
(
activeKey
,
false
);
}
// 关闭当前ab
function
handleEdit
(
targetKey
:
string
)
{
// 新增操作隐藏,目前只使用删除操作
...
...
src/settings/projectSetting.ts
浏览文件 @
beb4c3a3
...
...
@@ -51,7 +51,7 @@ const setting: ProjectConfig = {
// 是否显示搜索框
showSearch
:
true
,
// 菜单宽度
menuWidth
:
20
0
,
menuWidth
:
18
0
,
// 菜单模式
mode
:
MenuModeEnum
.
INLINE
,
// 菜单类型
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录