Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit df6341f0
authored
Mar 30, 2025
by
Jin Mao
Committed by
GitHub
Mar 30, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat(tabbar): 添加右键菜单过滤功能 (#5820)
1 parent
dbc0b7e4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
4 deletions
packages/effects/layouts/src/basic/tabbar/use-tabbar.ts
packages/stores/src/modules/tabbar.ts
playground/src/layouts/basic.vue
packages/effects/layouts/src/basic/tabbar/use-tabbar.ts
View file @
df6341f
...
...
@@ -209,7 +209,8 @@ export function useTabbar() {
text
:
$t
(
'preferences.tabbar.contextMenu.closeAll'
),
},
];
return
menus
;
return
menus
.
filter
((
item
)
=>
tabbarStore
.
getMenuList
.
includes
(
item
.
key
));
};
return
{
...
...
packages/stores/src/modules/tabbar.ts
View file @
df6341f
...
...
@@ -27,6 +27,10 @@ interface TabbarState {
*/
excludeCachedTabs
:
Set
<
string
>
;
/**
* @zh_CN 标签右键菜单列表
*/
menuList
:
string
[];
/**
* @zh_CN 是否刷新
*/
renderRouteView
?:
boolean
;
...
...
@@ -373,6 +377,14 @@ export const useTabbarStore = defineStore('core-tabbar', {
},
/**
* @zh_CN 更新菜单列表
* @param list
*/
setMenuList
(
list
:
string
[])
{
this
.
menuList
=
list
;
},
/**
* @zh_CN 设置标签页标题
* @param tab
* @param title
...
...
@@ -388,7 +400,6 @@ export const useTabbarStore = defineStore('core-tabbar', {
await
this
.
updateCacheTabs
();
}
},
setUpdateTime
()
{
this
.
updateTime
=
Date
.
now
();
},
...
...
@@ -406,6 +417,7 @@ export const useTabbarStore = defineStore('core-tabbar', {
this
.
tabs
.
splice
(
newIndex
,
0
,
currentTab
);
this
.
dragEndIndex
=
this
.
dragEndIndex
+
1
;
},
/**
* @zh_CN 切换固定标签页
* @param tab
...
...
@@ -439,7 +451,6 @@ export const useTabbarStore = defineStore('core-tabbar', {
// 交换位置重新排序
await
this
.
sortTabs
(
index
,
newIndex
);
},
/**
* 根据当前打开的选项卡更新缓存
*/
...
...
@@ -480,6 +491,9 @@ export const useTabbarStore = defineStore('core-tabbar', {
getExcludeCachedTabs
():
string
[]
{
return
[...
this
.
excludeCachedTabs
];
},
getMenuList
():
string
[]
{
return
this
.
menuList
;
},
getTabs
():
TabDefinition
[]
{
const
normalTabs
=
this
.
tabs
.
filter
((
tab
)
=>
!
isAffixTab
(
tab
));
return
[...
this
.
affixTabs
,
...
normalTabs
].
filter
(
Boolean
);
...
...
@@ -496,6 +510,17 @@ export const useTabbarStore = defineStore('core-tabbar', {
cachedTabs
:
new
Set
(),
dragEndIndex
:
0
,
excludeCachedTabs
:
new
Set
(),
menuList
:
[
'close'
,
'affix'
,
'maximize'
,
'reload'
,
'open-in-new-window'
,
'close-left'
,
'close-right'
,
'close-other'
,
'close-all'
,
],
renderRouteView
:
true
,
tabs
:
[],
updateTime
:
Date
.
now
(),
...
...
playground/src/layouts/basic.vue
View file @
df6341f
...
...
@@ -14,13 +14,26 @@ import {
UserDropdown
,
}
from
'@vben/layouts'
;
import
{
preferences
}
from
'@vben/preferences'
;
import
{
useAccessStore
,
useUserStore
}
from
'@vben/stores'
;
import
{
useAccessStore
,
use
TabbarStore
,
use
UserStore
}
from
'@vben/stores'
;
import
{
openWindow
}
from
'@vben/utils'
;
import
{
$t
}
from
'#/locales'
;
import
{
useAuthStore
}
from
'#/store'
;
import
LoginForm
from
'#/views/_core/authentication/login.vue'
;
const
{
setMenuList
}
=
useTabbarStore
();
setMenuList
([
'close'
,
'affix'
,
'maximize'
,
'reload'
,
'open-in-new-window'
,
'close-left'
,
'close-right'
,
'close-other'
,
'close-all'
,
]);
const
notifications
=
ref
<
NotificationItem
[]
>
([
{
avatar
:
'https://avatar.vercel.sh/vercel.svg?text=VB'
,
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment