Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-layout
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
packages
pro-layout
Commits
9bdab4c1
Commit
9bdab4c1
authored
Dec 11, 2020
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: sidemenu theme
parent
0bd9c2e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
11 deletions
+19
-11
side-menu.tsx
examples/side-menu.tsx
+17
-8
SiderMenu.tsx
src/SiderMenu/SiderMenu.tsx
+2
-2
index.tsx
src/SiderMenu/index.tsx
+0
-1
No files found.
examples/side-menu.tsx
View file @
9bdab4c1
import
{
createApp
}
from
'vue'
;
import
{
createApp
,
reactive
}
from
'vue'
;
import
'ant-design-vue/dist/antd.less'
;
import
'./side-menu.less'
;
import
{
Layout
,
Input
,
message
}
from
'ant-design-vue'
;
import
{
Layout
,
Input
,
Space
,
Switch
,
message
}
from
'ant-design-vue'
;
import
{
menus
}
from
'./menus'
;
import
{
default
as
SiderMenuWrapper
}
from
'../src/SiderMenu'
;
import
{
useMenuState
}
from
'../src/SiderMenu/BaseMenu'
;
import
*
as
Icon
from
'@ant-design/icons-vue'
;
import
{
MenuTheme
}
from
'../src/typings'
;
const
DemoComponent
=
{
setup
()
{
...
...
@@ -15,6 +16,9 @@ const DemoComponent = {
openKeys
:
[
''
],
selectedKeys
:
[
'/welcome'
],
});
const
state
=
reactive
({
theme
:
'dark'
,
})
const
handleCollapse
=
(
collapsed
:
boolean
)
=>
{
menuState
.
collapsed
=
collapsed
;
...
...
@@ -29,13 +33,18 @@ const DemoComponent = {
return
()
=>
(
<
div
class=
"components"
>
<
h2
>
# SideMenu
</
h2
>
<
div
>
<
Space
>
<
Switch
checked
-
children=
"dark"
un
-
checked
-
children=
"light"
checked=
{
state
.
theme
===
'dark'
}
onChange=
{
()
=>
{
(
state
.
theme
=
state
.
theme
===
'dark'
?
'light'
:
'dark'
)}
}
/>
</
Space
>
</
div
>
<
div
class=
"demo"
style=
"background: rgb(244,244,244); min-height: 400px;"
>
<
div
class=
"container side-menu-demo"
>
<
Layout
class=
"ant-pro-basicLayout"
>
<
SiderMenuWrapper
title=
{
'Pro Layout'
}
layout=
{
'side'
}
theme=
{
'dark'
}
theme=
{
state
.
theme
as
MenuTheme
}
isMobile=
{
false
}
collapsed=
{
menuState
.
collapsed
}
menuData=
{
menus
}
...
...
@@ -55,11 +64,11 @@ const DemoComponent = {
}
}
/>
</
div
>
)
:
null
}
menuFooterRender=
{
(
props
)
=>
props
.
collapsed
?
undefined
:
(
<
div
style=
"color: #fff; padding: 8px 16px; overflow: hidden;"
>
<
span
>
自定义页脚
</
span
>
</
div
>
)
}
//
menuFooterRender={(props) => props.collapsed ? undefined : (
// <div
style="color: #fff; padding: 8px 16px; overflow: hidden;">
//
<span>自定义页脚</span>
//
</div>
//
)}
/>
<
Layout
>
<
Layout
.
Header
style=
"background: #fff; padding: 0; height: 48px; line-height: 48px;"
></
Layout
.
Header
>
...
...
src/SiderMenu/SiderMenu.tsx
View file @
9bdab4c1
...
...
@@ -103,14 +103,14 @@ const SiderMenu: FunctionalComponent<SiderMenuProps> = (props: SiderMenuProps) =
// const isMix = computed(() => props.layout === 'mix');
const
fixed
=
computed
(()
=>
props
.
fixed
);
const
runtimeTheme
=
computed
(()
=>
(
props
.
layout
===
'mix'
&&
'light'
)
||
'dark'
);
//
const runtimeTheme = computed(() => (props.layout === 'mix' && 'light') || 'dark');
const
runtimeSideWidth
=
computed
(()
=>
props
.
collapsed
?
props
.
collapsedWidth
:
props
.
siderWidth
,
);
const
classNames
=
ref
({
[
baseClassName
]:
true
,
[
`
${
baseClassName
}
-
${
runtimeTheme
.
valu
e
}
`
]:
true
,
[
`
${
baseClassName
}
-
${
them
e
}
`
]:
true
,
[
`
${
baseClassName
}
-
${
props
.
layout
}
`
]:
true
,
[
`
${
baseClassName
}
-fixed`
]:
fixed
,
});
...
...
src/SiderMenu/index.tsx
View file @
9bdab4c1
...
...
@@ -8,7 +8,6 @@ import SiderMenu, { SiderMenuProps, PrivateSiderMenuProps } from './SiderMenu';
export
type
SiderMenuWrapperProps
=
SiderMenuProps
&
Partial
<
PrivateSiderMenuProps
>
;
const
SiderMenuWrapper
:
FunctionalComponent
<
SiderMenuWrapperProps
>
=
(
props
,
{
attrs
})
=>
{
console
.
log
(
'SiderMenuWrapper'
,
props
,
attrs
)
return
props
.
isMobile
?
(
<
Drawer
>
<
SiderMenu
{
...
props
}
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment