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 352119cc
authored
May 25, 2024
by
vben
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 修复tabs已知问题
1 parent
977d108c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
129 additions
and
88 deletions
apps/antd-view/src/router/routes/modules/vben.ts
internal/tsconfig/package.json
internal/vite-config/package.json
package.json
packages/@vben-core/uikit/layout-ui/src/vben-layout.vue
packages/@vben-core/uikit/menu-ui/src/menu.vue
packages/@vben-core/uikit/tabs-ui/src/styles/tabs.scss → packages/@vben-core/uikit/tabs-ui/src/components/chrome-tabs/chrome-tabs.scss
packages/@vben-core/uikit/tabs-ui/src/components/tab-background.vue → packages/@vben-core/uikit/tabs-ui/src/components/chrome-tabs/tab-background.vue
packages/@vben-core/uikit/tabs-ui/src/components/tab.vue → packages/@vben-core/uikit/tabs-ui/src/components/chrome-tabs/tab.vue
packages/@vben-core/uikit/tabs-ui/src/components/tabs.vue → packages/@vben-core/uikit/tabs-ui/src/components/chrome-tabs/tabs.vue
packages/@vben-core/uikit/tabs-ui/src/components/index.ts
packages/@vben-core/uikit/tabs-ui/src/components/tabs/index.vue
packages/@vben-core/uikit/tabs-ui/src/index.ts
packages/@vben-core/uikit/tabs-ui/src/interface.ts
packages/@vben-core/uikit/tabs-ui/src/tabs-view.vue
pnpm-lock.yaml
apps/antd-view/src/router/routes/modules/vben.ts
View file @
352119c
...
@@ -10,7 +10,7 @@ export const vbenRoutes: RouteRecordRaw[] = [
...
@@ -10,7 +10,7 @@ export const vbenRoutes: RouteRecordRaw[] = [
component
:
BasicLayout
,
component
:
BasicLayout
,
meta
:
{
meta
:
{
icon
:
preference
.
logo
,
icon
:
preference
.
logo
,
title
:
'Vben
Admin
'
,
title
:
'Vben'
,
},
},
name
:
'AboutLayout'
,
name
:
'AboutLayout'
,
path
:
'/vben-admin'
,
path
:
'/vben-admin'
,
...
...
internal/tsconfig/package.json
View file @
352119c
...
@@ -20,6 +20,6 @@
...
@@ -20,6 +20,6 @@
],
],
"dependencies"
:
{
"dependencies"
:
{
"@vben/types"
:
"workspace:*"
,
"@vben/types"
:
"workspace:*"
,
"vite"
:
"
^6.0.0-alpha.17
"
"vite"
:
"
5.2.11
"
}
}
}
}
internal/vite-config/package.json
View file @
352119c
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
"rollup-plugin-visualizer"
:
"^5.12.0"
,
"rollup-plugin-visualizer"
:
"^5.12.0"
,
"sass"
:
"^1.77.2"
,
"sass"
:
"^1.77.2"
,
"unplugin-turbo-console"
:
"^1.8.6"
,
"unplugin-turbo-console"
:
"^1.8.6"
,
"vite"
:
"
^6.0.0-alpha.17
"
,
"vite"
:
"
5.2.11
"
,
"vite-plugin-compression"
:
"^0.5.1"
,
"vite-plugin-compression"
:
"^0.5.1"
,
"vite-plugin-dts"
:
"^3.9.1"
,
"vite-plugin-dts"
:
"^3.9.1"
,
"vite-plugin-html"
:
"^3.2.2"
,
"vite-plugin-html"
:
"^3.2.2"
,
...
...
package.json
View file @
352119c
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
"turbo"
:
"^1.13.3"
,
"turbo"
:
"^1.13.3"
,
"typescript"
:
"^5.4.5"
,
"typescript"
:
"^5.4.5"
,
"unbuild"
:
"^2.0.0"
,
"unbuild"
:
"^2.0.0"
,
"vite"
:
"
^6.0.0-alpha.17
"
,
"vite"
:
"
5.2.11
"
,
"vitest"
:
"^2.0.0-beta.3"
,
"vitest"
:
"^2.0.0-beta.3"
,
"vue-tsc"
:
"^2.0.19"
"vue-tsc"
:
"^2.0.19"
},
},
...
...
packages/@vben-core/uikit/layout-ui/src/vben-layout.vue
View file @
352119c
...
@@ -48,7 +48,7 @@ const props = withDefaults(defineProps<Props>(), {
...
@@ -48,7 +48,7 @@ const props = withDefaults(defineProps<Props>(), {
sideTheme
:
'dark'
,
sideTheme
:
'dark'
,
sideWidth
:
180
,
sideWidth
:
180
,
// tabsBackgroundColor: 'hsl(var(--color-background))',
// tabsBackgroundColor: 'hsl(var(--color-background))',
tabsHeight
:
3
8
,
tabsHeight
:
3
6
,
tabsVisible
:
true
,
tabsVisible
:
true
,
zIndex
:
200
,
zIndex
:
200
,
});
});
...
...
packages/@vben-core/uikit/menu-ui/src/menu.vue
View file @
352119c
...
@@ -12,7 +12,7 @@ interface Props extends MenuProps {
...
@@ -12,7 +12,7 @@ interface Props extends MenuProps {
}
}
defineOptions
({
defineOptions
({
name
:
'Menu
Ui
'
,
name
:
'Menu
View
'
,
});
});
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
...
...
packages/@vben-core/uikit/tabs-ui/src/
styles/
tabs.scss
→
packages/@vben-core/uikit/tabs-ui/src/
components/chrome-tabs/chrome-
tabs.scss
View file @
352119c
@import
'@vben-core/design/global'
;
@import
'@vben-core/design/global'
;
@include
b
(
'
tabs-ui
'
)
{
@include
b
(
'
chrome-tabs
'
)
{
--tabs-background
:
hsl
(
var
(
--
color-background
));
--tabs-background
:
hsl
(
var
(
--
color-background
));
--tabs-gap
:
10
px
;
--tabs-gap
:
7
px
;
--tabs-divider
:
hsl
(
var
(
--
color-border
));
--tabs-divider
:
hsl
(
var
(
--
color-border
));
--tabs-hover
:
hsl
(
var
(
--
color-heavy
));
--tabs-hover
:
hsl
(
var
(
--
color-heavy
));
--tabs-active-background
:
hsl
(
var
(
--
color-primary
)
/
1
5
%
);
--tabs-active-background
:
hsl
(
var
(
--
color-primary
)
/
1
00
%
);
--tabs-active
:
hsl
(
var
(
--
color-primary
));
--tabs-active
:
hsl
(
var
(
--
color-primary
-foreground
));
position
:
relative
;
position
:
relative
;
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
padding-top
:
2
px
;
padding-top
:
4
px
;
background-color
:
var
(
--
tabs-background
);
background-color
:
var
(
--
tabs-background
);
@include
e
(
'content'
)
{
@include
e
(
'content'
)
{
position
:
relative
;
position
:
relative
;
height
:
100%
;
height
:
32px
;
overflow
:
hidden
;
overflow
:
hidden
;
}
}
}
}
@include
b
(
'tab'
)
{
@include
b
(
'
chrome-
tab'
)
{
position
:
absolute
;
position
:
absolute
;
box-sizing
:
border-box
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
height
:
100%
;
height
:
100%
;
...
@@ -32,24 +31,24 @@
...
@@ -32,24 +31,24 @@
user-select
:
none
;
user-select
:
none
;
@include
is
(
'active'
)
{
@include
is
(
'active'
)
{
z-index
:
1
;
z-index
:
2
;
color
:
var
(
--
tabs-active
);
color
:
var
(
--
tabs-active
);
.
#{
$namespace
}
-tab__extra
:not
(
.is-pin
)
{
.
#{
$namespace
}
-
chrome-
tab__extra
:not
(
.is-pin
)
{
background-color
:
var
(
--
tabs-active-background
);
background-color
:
var
(
--
tabs-active-background
);
opacity
:
1
;
opacity
:
1
;
}
}
.
#{
$namespace
}
-tab-background__divider
{
.
#{
$namespace
}
-
chrome-
tab-background__divider
{
display
:
none
;
display
:
none
;
}
}
.
#{
$namespace
}
-tab-background__content
{
.
#{
$namespace
}
-
chrome-
tab-background__content
{
background-color
:
var
(
--
tabs-active-background
);
background-color
:
var
(
--
tabs-active-background
);
}
}
.
#{
$namespace
}
-tab-background__before
,
.
#{
$namespace
}
-
chrome-
tab-background__before
,
.
#{
$namespace
}
-tab-background__after
{
.
#{
$namespace
}
-
chrome-
tab-background__after
{
fill
:
var
(
--
tabs-active-background
);
fill
:
var
(
--
tabs-active-background
);
}
}
}
}
...
@@ -58,8 +57,7 @@
...
@@ -58,8 +57,7 @@
position
:
absolute
;
position
:
absolute
;
right
:
0
;
right
:
0
;
left
:
0
;
left
:
0
;
z-index
:
1
;
// z-index: 1;
box-sizing
:
border-box
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
height
:
100%
;
height
:
100%
;
...
@@ -73,19 +71,18 @@
...
@@ -73,19 +71,18 @@
@include
e
(
'extra'
)
{
@include
e
(
'extra'
)
{
position
:
absolute
;
position
:
absolute
;
top
:
50%
;
top
:
50%
;
right
:
calc
(
var
(
--
tabs-gap
)
*
1
.5
);
right
:
calc
(
var
(
--
tabs-gap
)
*
2
);
z-index
:
1
;
z-index
:
1
;
width
:
14px
;
width
:
14px
;
height
:
14px
;
height
:
14px
;
border-radius
:
50%
;
border-radius
:
50%
;
opacity
:
0
;
opacity
:
0
;
transition
:
0
.15s
;
// transition: all 0.15s ease;
transform
:
translateY
(
-50%
);
transform
:
translateY
(
-50%
);
&
:hover
{
//
&:hover {
// background-color: hsl(var(--color-accent));
// background-color: hsl(var(--color-accent));
}
//
}
}
}
@include
e
(
'extra-icon'
)
{
@include
e
(
'extra-icon'
)
{
...
@@ -116,14 +113,26 @@
...
@@ -116,14 +113,26 @@
@include
e
(
'label'
)
{
@include
e
(
'label'
)
{
position
:
relative
;
position
:
relative
;
box-sizing
:
border-box
;
flex
:
1
;
flex
:
1
;
margin-right
:
px
;
margin-right
:
8
px
;
margin-left
:
5%
;
margin-left
:
5%
;
overflow
:
hidden
;
overflow
:
hidden
;
font-size
:
14px
;
font-size
:
14px
;
text-align
:
center
;
white-space
:
nowrap
;
white-space
:
nowrap
;
mask-image
:
linear-gradient
(
90deg
,
#000
0%
,
#000
calc
(
100%
-
20px
)
,
transparent
);
// &.no-close {
// margin-right: 0;
// }
// &.no-icon {
// margin-left: 0;
// }
}
}
@include
is
(
'hidden-icon'
)
{
@include
is
(
'hidden-icon'
)
{
...
@@ -131,51 +140,44 @@
...
@@ -131,51 +140,44 @@
}
}
&
:hover
{
&
:hover
{
.
#{
$namespace
}
-tab__extra.is-pin
{
.
#{
$namespace
}
-
chrome-
tab__extra.is-pin
{
opacity
:
1
;
opacity
:
1
;
}
}
}
}
&
:not
(
.is-active
)
:hover
{
&
:not
(
.is-active
)
:hover
{
z-index
:
1
0
;
z-index
:
1
;
.
#{
$namespace
}
-tab__extra
{
.
#{
$namespace
}
-
chrome-
tab__extra
{
opacity
:
1
;
opacity
:
1
;
}
}
.
#{
$namespace
}
-tab-background__divider
{
.
#{
$namespace
}
-
chrome-
tab-background__divider
{
display
:
none
;
display
:
none
;
}
}
.
#{
$namespace
}
-tab-background__content
{
.
#{
$namespace
}
-
chrome-
tab-background__content
{
background-color
:
var
(
--
tabs-hover
);
background-color
:
var
(
--
tabs-hover
);
}
}
.
#{
$namespace
}
-tab-background__before
,
.
#{
$namespace
}
-
chrome-
tab-background__before
,
.
#{
$namespace
}
-tab-background__after
{
.
#{
$namespace
}
-
chrome-
tab-background__after
{
fill
:
var
(
--
tabs-hover
);
fill
:
var
(
--
tabs-hover
);
}
}
}
}
&
:last-of-type
{
.
#{
$namespace
}
-tab-background__divider
::after
{
display
:
none
;
}
}
&
:first-of-type
{
&
:first-of-type
{
.
#{
$namespace
}
-tab-background__divider
::before
{
.
#{
$namespace
}
-
chrome-
tab-background__divider
::before
{
display
:
none
;
display
:
none
;
}
}
}
}
}
}
@include
b
(
'tab-background'
)
{
@include
b
(
'
chrome-
tab-background'
)
{
position
:
absolute
;
position
:
absolute
;
box-sizing
:
border-box
;
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
padding
:
0
calc
(
var
(
--
tabs-gap
)
-
1
px
);
padding
:
0
calc
(
var
(
--
tabs-gap
)
+
0
px
);
@include
e
(
'divider'
)
{
@include
e
(
'divider'
)
{
position
:
absolute
;
position
:
absolute
;
...
@@ -184,45 +186,47 @@
...
@@ -184,45 +186,47 @@
height
:
100%
;
height
:
100%
;
margin
:
0
7px
;
margin
:
0
7px
;
//
&::before {
&
:
:
before
{
//
position: absolute;
position
:
absolute
;
//
top: 20%;
top
:
20%
;
//
right: 100%;
right
:
100%
;
//
width: 1px;
width
:
1px
;
//
height: 60%;
height
:
60%
;
//
content: '';
content
:
''
;
//
background-color: var(--tabs-divider);
background-color
:
var
(
--
tabs-divider
);
//
}
}
//
&::after {
&
:
:
after
{
//
position: absolute;
position
:
absolute
;
//
top: 20%;
top
:
20%
;
//
left: calc(100% - 1px);
left
:
calc
(
100%
-
1px
);
//
width: 1px;
width
:
1px
;
//
height: 60%;
height
:
60%
;
//
content: '';
content
:
''
;
//
background-color: var(--tabs-divider);
background-color
:
var
(
--
tabs-divider
);
//
}
}
}
}
@include
e
(
'content'
)
{
@include
e
(
'content'
)
{
height
:
100%
;
height
:
100%
;
border-top-left-radius
:
8
px
;
border-top-left-radius
:
5
px
;
border-top-right-radius
:
8
px
;
border-top-right-radius
:
5
px
;
transition
:
background
0
.15s
ease
;
transition
:
background
0
.15s
ease
;
}
}
@include
e
(
'before'
)
{
@include
e
(
'before'
)
{
position
:
absolute
;
position
:
absolute
;
bottom
:
-1px
;
bottom
:
-1px
;
left
:
-
1
px
;
left
:
-
3
px
;
fill
:
transparent
;
fill
:
transparent
;
transition
:
0
.15s
;
}
}
@include
e
(
'after'
)
{
@include
e
(
'after'
)
{
position
:
absolute
;
position
:
absolute
;
right
:
-
1
px
;
right
:
-
3
px
;
bottom
:
-1px
;
bottom
:
-1px
;
fill
:
transparent
;
fill
:
transparent
;
transition
:
0
.15s
;
}
}
}
}
packages/@vben-core/uikit/tabs-ui/src/components/tab-background.vue
→
packages/@vben-core/uikit/tabs-ui/src/components/
chrome-tabs/
tab-background.vue
View file @
352119c
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
import
{
useNamespace
}
from
'@vben-core/toolkit'
;
import
{
useNamespace
}
from
'@vben-core/toolkit'
;
defineOptions
({
defineOptions
({
name
:
'TabBackground'
,
name
:
'
Chrome
TabBackground'
,
});
});
const
{
b
,
e
}
=
useNamespace
(
'tab-background'
);
const
{
b
,
e
}
=
useNamespace
(
'
chrome-
tab-background'
);
</
script
>
</
script
>
<
template
>
<
template
>
...
...
packages/@vben-core/uikit/tabs-ui/src/components/tab.vue
→
packages/@vben-core/uikit/tabs-ui/src/components/
chrome-tabs/
tab.vue
View file @
352119c
...
@@ -19,7 +19,7 @@ interface Props {
...
@@ -19,7 +19,7 @@ interface Props {
}
}
defineOptions
({
defineOptions
({
name
:
'Tab'
,
name
:
'
Chrome
Tab'
,
});
});
withDefaults
(
defineProps
<
Props
>
(),
{
withDefaults
(
defineProps
<
Props
>
(),
{
...
@@ -27,7 +27,7 @@ withDefaults(defineProps<Props>(), {
...
@@ -27,7 +27,7 @@ withDefaults(defineProps<Props>(), {
});
});
const
emit
=
defineEmits
<
{
close
:
[];
unPushPin
:
[]
}
>
();
const
emit
=
defineEmits
<
{
close
:
[];
unPushPin
:
[]
}
>
();
const
{
b
,
e
,
is
}
=
useNamespace
(
'tab'
);
const
{
b
,
e
,
is
}
=
useNamespace
(
'
chrome-
tab'
);
function
handleClose
()
{
function
handleClose
()
{
emit
(
'close'
);
emit
(
'close'
);
...
...
packages/@vben-core/uikit/tabs-ui/src/components/tabs.vue
→
packages/@vben-core/uikit/tabs-ui/src/components/
chrome-tabs/
tabs.vue
View file @
352119c
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
type
{
IContextMenuItem
}
from
'@vben-core/shadcn-ui
'
;
import
type
{
TabItem
}
from
'@vben-core/typings
'
;
import
{
useNamespace
}
from
'@vben-core/toolkit'
;
import
{
useNamespace
}
from
'@vben-core/toolkit'
;
import
{
TabItem
}
from
'@vben-core/typings'
;
import
{
computed
,
nextTick
,
onMounted
,
ref
,
watch
}
from
'vue'
;
import
{
computed
,
nextTick
,
onMounted
,
ref
,
watch
}
from
'vue'
;
import
Tab
from
'./tab.vue'
;
import
Tab
from
'./tab.vue'
;
interface
Props
{
import
type
{
TabsProps
}
from
'../../interface'
;
maxWidth
?:
number
;
menus
?:
(
data
:
any
)
=>
IContextMenuItem
[];
interface
Props
extends
TabsProps
{}
minWidth
?:
number
;
showIcon
?:
boolean
;
tabs
?:
TabItem
[];
}
defineOptions
({
defineOptions
({
name
:
'Tabs'
,
name
:
'
Chrome
Tabs'
,
});
});
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
...
@@ -29,10 +24,10 @@ const props = withDefaults(defineProps<Props>(), {
...
@@ -29,10 +24,10 @@ const props = withDefaults(defineProps<Props>(), {
const
emit
=
defineEmits
<
{
close
:
[
string
];
unPushPin
:
[
TabItem
]
}
>
();
const
emit
=
defineEmits
<
{
close
:
[
string
];
unPushPin
:
[
TabItem
]
}
>
();
const
gap
=
6
;
const
gap
=
7
;
const
active
=
defineModel
<
string
>
(
'active'
);
const
active
=
defineModel
<
string
>
(
'active'
);
const
{
b
,
e
,
is
}
=
useNamespace
(
'
tabs-ui
'
);
const
{
b
,
e
,
is
}
=
useNamespace
(
'
chrome-tabs
'
);
const
contentRef
=
ref
();
const
contentRef
=
ref
();
const
tabWidth
=
ref
<
number
>
(
0
);
const
tabWidth
=
ref
<
number
>
(
0
);
...
@@ -115,5 +110,5 @@ function handleUnPushPin(tab: TabItem) {
...
@@ -115,5 +110,5 @@ function handleUnPushPin(tab: TabItem) {
</div>
</div>
</
template
>
</
template
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
@import
'.
./styles/
tabs.scss'
;
@import
'.
/chrome-
tabs.scss'
;
</
style
>
</
style
>
packages/@vben-core/uikit/tabs-ui/src/components/index.ts
View file @
352119c
export
{
default
as
Tabs
}
from
'.
/tabs.vue'
;
export
{
default
as
ChromeTabs
}
from
'./chrome-tabs
/tabs.vue'
;
export
{
default
as
TabsMore
}
from
'./tabs-more.vue'
;
export
{
default
as
TabsMore
}
from
'./tabs-more.vue'
;
export
{
default
as
TabsScreen
}
from
'./tabs-screen.vue'
;
export
{
default
as
TabsScreen
}
from
'./tabs-screen.vue'
;
packages/@vben-core/uikit/tabs-ui/src/components/tabs/index.vue
0 → 100644
View file @
352119c
<
script
lang=
"ts"
setup
></
script
>
<
template
>
<div></div>
</
template
>
packages/@vben-core/uikit/tabs-ui/src/index.ts
View file @
352119c
export
{
Tabs
as
TabsView
,
TabsMore
,
TabsScreen
}
from
'./components'
;
export
{
TabsMore
,
TabsScreen
}
from
'./components'
;
export
{
default
as
TabsView
}
from
'./tabs-view.vue'
;
export
type
{
IContextMenuItem
}
from
'@vben-core/shadcn-ui'
;
export
type
{
IContextMenuItem
}
from
'@vben-core/shadcn-ui'
;
packages/@vben-core/uikit/tabs-ui/src/interface.ts
0 → 100644
View file @
352119c
import
type
{
IContextMenuItem
}
from
'@vben-core/shadcn-ui'
;
import
type
{
TabItem
}
from
'@vben-core/typings'
;
interface
TabsProps
{
maxWidth
?:
number
;
menus
?:
(
data
:
any
)
=>
IContextMenuItem
[];
minWidth
?:
number
;
showIcon
?:
boolean
;
tabs
?:
TabItem
[];
}
export
type
{
TabsProps
};
packages/@vben-core/uikit/tabs-ui/src/tabs-view.vue
0 → 100644
View file @
352119c
<
script
setup
lang=
"ts"
>
import
type
{
TabItem
}
from
'@vben-core/typings'
;
import
{
useForwardPropsEmits
}
from
'@vben-core/shadcn-ui'
;
import
{
ChromeTabs
}
from
'./components'
;
import
{
TabsProps
}
from
'./interface'
;
interface
Props
extends
TabsProps
{}
defineOptions
({
name
:
'TabsView'
,
});
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{});
const
emit
=
defineEmits
<
{
close
:
[
string
];
unPushPin
:
[
TabItem
]
}
>
();
const
forward
=
useForwardPropsEmits
(
props
,
emit
);
</
script
>
<
template
>
<ChromeTabs
v-bind=
"forward"
/>
</
template
>
pnpm-lock.yaml
View file @
352119c
This diff is collapsed.
Click to expand it.
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