Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ant-design-pro-vue
Overview
Overview
Details
Activity
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
tianzhuanghu
ant-design-pro-vue
Commits
c5a50470
Commit
c5a50470
authored
Jan 10, 2019
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: #51 sidebar collapsed padding
parent
cac3a58a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
11 deletions
+26
-11
App.vue
src/App.vue
+3
-7
GlobalLayout.vue
src/components/page/GlobalLayout.vue
+22
-4
mixin.js
src/utils/mixin.js
+1
-0
No files found.
src/App.vue
View file @
c5a50470
...
@@ -9,18 +9,15 @@
...
@@ -9,18 +9,15 @@
<
script
>
<
script
>
import
zhCN
from
'ant-design-vue/lib/locale-provider/zh_CN'
import
zhCN
from
'ant-design-vue/lib/locale-provider/zh_CN'
import
{
deviceEnquire
,
DEVICE_TYPE
}
from
'@/utils/device'
import
{
deviceEnquire
,
DEVICE_TYPE
}
from
'@/utils/device'
import
{
version
}
from
'ant-design-vue'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
locale
:
zhCN
,
locale
:
zhCN
version
}
}
},
},
mounted
()
{
mounted
()
{
const
{
$store
}
=
this
const
{
$store
}
=
this
console
.
log
(
'use Ant-Design Of Vue:'
,
version
)
deviceEnquire
(
deviceType
=>
{
deviceEnquire
(
deviceType
=>
{
switch
(
deviceType
)
{
switch
(
deviceType
)
{
...
@@ -29,14 +26,13 @@
...
@@ -29,14 +26,13 @@
$store
.
dispatch
(
'setSidebar'
,
true
)
$store
.
dispatch
(
'setSidebar'
,
true
)
break
break
case
DEVICE_TYPE
.
TABLET
:
case
DEVICE_TYPE
.
TABLET
:
console
.
log
(
'tablet'
)
$store
.
commit
(
'TOGGLE_DEVICE'
,
'tablet'
)
$store
.
dispatch
(
'ToggleDevice'
,
'tablet'
)
$store
.
dispatch
(
'setSidebar'
,
false
)
$store
.
dispatch
(
'setSidebar'
,
false
)
break
break
case
DEVICE_TYPE
.
MOBILE
:
case
DEVICE_TYPE
.
MOBILE
:
default
:
default
:
$store
.
commit
(
'TOGGLE_DEVICE'
,
'mobile'
)
$store
.
commit
(
'TOGGLE_DEVICE'
,
'mobile'
)
$store
.
dispatch
(
'setSidebar'
,
false
)
$store
.
dispatch
(
'setSidebar'
,
true
)
break
break
}
}
console
.
log
(
'deviceType'
,
deviceType
)
console
.
log
(
'deviceType'
,
deviceType
)
...
...
src/components/page/GlobalLayout.vue
View file @
c5a50470
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
</a-drawer>
</a-drawer>
</
template
>
</
template
>
<a-layout
:class=
"[layoutMode, `content-width-${contentWidth}`]"
:style=
"{ paddingLeft:
fixSiderbar && isDesktop() ? `${sidebarOpened ? 256 : 80}px` : '0', minHeight: '100vh' }"
>
<a-layout
:class=
"[layoutMode, `content-width-${contentWidth}`]"
:style=
"{ paddingLeft:
contentPaddingLeft, minHeight: '100vh' }"
>
<!-- layout header -->
<!-- layout header -->
<global-header
<global-header
:mode=
"layoutMode"
:mode=
"layoutMode"
...
@@ -64,7 +64,7 @@
...
@@ -64,7 +64,7 @@
</a-layout-content>
</a-layout-content>
<!-- layout footer -->
<!-- layout footer -->
<a-layout-footer
style=
"padding: 0
px"
>
<a-layout-footer
style=
"padding: 0
"
>
<global-footer
/>
<global-footer
/>
</a-layout-footer>
</a-layout-footer>
<setting-drawer></setting-drawer>
<setting-drawer></setting-drawer>
...
@@ -100,7 +100,16 @@
...
@@ -100,7 +100,16 @@
...
mapState
({
...
mapState
({
// 主路由
// 主路由
mainMenu
:
state
=>
state
.
permission
.
addRouters
,
mainMenu
:
state
=>
state
.
permission
.
addRouters
,
})
}),
contentPaddingLeft
()
{
if
(
!
this
.
fixSidebar
||
this
.
isMobile
()){
return
'0'
}
if
(
this
.
sidebarOpened
){
return
'256px'
}
return
'80px'
}
},
},
watch
:
{
watch
:
{
sidebarOpened
(
val
)
{
sidebarOpened
(
val
)
{
...
@@ -110,7 +119,6 @@
...
@@ -110,7 +119,6 @@
},
},
created
()
{
created
()
{
this
.
menus
=
this
.
mainMenu
.
find
((
item
)
=>
item
.
path
===
'/'
).
children
this
.
menus
=
this
.
mainMenu
.
find
((
item
)
=>
item
.
path
===
'/'
).
children
console
.
log
(
'created/sidebarOpened'
,
this
.
sidebarOpened
)
this
.
collapsed
=
!
this
.
sidebarOpened
this
.
collapsed
=
!
this
.
sidebarOpened
},
},
methods
:
{
methods
:
{
...
@@ -120,6 +128,16 @@
...
@@ -120,6 +128,16 @@
this
.
setSidebar
(
!
this
.
collapsed
)
this
.
setSidebar
(
!
this
.
collapsed
)
triggerWindowResizeEvent
()
triggerWindowResizeEvent
()
},
},
paddingCalc
()
{
let
left
=
''
if
(
this
.
sidebarOpened
)
{
left
=
this
.
isDesktop
()
?
'256px'
:
'80px'
}
else
{
left
=
this
.
isMobile
()
&&
'0'
||
(
this
.
fixSidebar
&&
'80px'
||
'0'
)
}
console
.
log
(
'left'
,
left
)
return
left
},
menuSelect
()
{
menuSelect
()
{
if
(
!
this
.
isDesktop
())
{
if
(
!
this
.
isDesktop
())
{
this
.
collapsed
=
false
this
.
collapsed
=
false
...
...
src/utils/mixin.js
View file @
c5a50470
...
@@ -14,6 +14,7 @@ const mixin = {
...
@@ -14,6 +14,7 @@ const mixin = {
colorWeak
:
state
=>
state
.
app
.
weak
,
colorWeak
:
state
=>
state
.
app
.
weak
,
fixedHeader
:
state
=>
state
.
app
.
fixedHeader
,
fixedHeader
:
state
=>
state
.
app
.
fixedHeader
,
fixSiderbar
:
state
=>
state
.
app
.
fixSiderbar
,
fixSiderbar
:
state
=>
state
.
app
.
fixSiderbar
,
fixSidebar
:
state
=>
state
.
app
.
fixSiderbar
,
contentWidth
:
state
=>
state
.
app
.
contentWidth
,
contentWidth
:
state
=>
state
.
app
.
contentWidth
,
autoHideHeader
:
state
=>
state
.
app
.
autoHideHeader
,
autoHideHeader
:
state
=>
state
.
app
.
autoHideHeader
,
sidebarOpened
:
state
=>
state
.
app
.
sidebar
sidebarOpened
:
state
=>
state
.
app
.
sidebar
...
...
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