Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
web-monitor
Project
Project
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
Administrator
web-monitor
Commits
5b7aafac
Commit
5b7aafac
authored
Dec 14, 2017
by
Pan
Committed by
花裤衩
Dec 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some bugs
parent
12012e3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
index.vue
src/components/ScrollBar/index.vue
+6
-5
SidebarItem.vue
src/views/layout/components/Sidebar/SidebarItem.vue
+4
-4
No files found.
src/components/ScrollBar/index.vue
View file @
5b7aafac
<
template
>
<div
class=
"scroll-container"
ref=
"scrollContainer"
@
mousewheel=
"handleScroll"
>
<div
class=
"scroll-container"
ref=
"scrollContainer"
@
wheel
.
prevent=
"handleScroll"
>
<div
class=
"scroll-wrapper"
ref=
"scrollWrapper"
:style=
"
{top: top + 'px'}">
<slot></slot>
</div>
...
...
@@ -8,6 +8,7 @@
<
script
>
const
delta
=
15
export
default
{
name
:
'scrollBar'
,
data
()
{
...
...
@@ -17,19 +18,19 @@ export default {
},
methods
:
{
handleScroll
(
e
)
{
e
.
preventDefault
()
const
eventDelta
=
e
.
wheelDelta
||
-
e
.
deltaY
*
3
const
$container
=
this
.
$refs
.
scrollContainer
const
$containerHeight
=
$container
.
offsetHeight
const
$wrapper
=
this
.
$refs
.
scrollWrapper
const
$wrapperHeight
=
$wrapper
.
offsetHeight
if
(
e
.
wheel
Delta
>
0
)
{
this
.
top
=
Math
.
min
(
0
,
this
.
top
+
e
.
wheel
Delta
)
if
(
e
vent
Delta
>
0
)
{
this
.
top
=
Math
.
min
(
0
,
this
.
top
+
e
vent
Delta
)
}
else
{
if
(
$containerHeight
-
delta
<
$wrapperHeight
)
{
if
(
this
.
top
<
-
(
$wrapperHeight
-
$containerHeight
+
delta
))
{
this
.
top
=
this
.
top
}
else
{
this
.
top
=
Math
.
max
(
this
.
top
+
e
.
wheel
Delta
,
$containerHeight
-
$wrapperHeight
-
delta
)
this
.
top
=
Math
.
max
(
this
.
top
+
e
vent
Delta
,
$containerHeight
-
$wrapperHeight
-
delta
)
}
}
else
{
this
.
top
=
0
...
...
src/views/layout/components/Sidebar/SidebarItem.vue
View file @
5b7aafac
<
template
>
<div
class=
"menu-wrapper"
>
<template
v-for=
"item in routes"
>
<template
v-for=
"item in routes"
v-if=
"!item.hidden&&item.children"
>
<router-link
v-if=
"
!item.hidden&&item.children&&item.children.length===1
"
:to=
"item.path+'/'+item.children[0].path"
:key=
"item.children[0].name"
>
<router-link
v-if=
"
item.children.length===1 && !item.children[0].children
"
:to=
"item.path+'/'+item.children[0].path"
:key=
"item.children[0].name"
>
<el-menu-item
:index=
"item.path+'/'+item.children[0].path"
class=
'submenu-title-noDropdown'
>
<svg-icon
v-if=
"item.children[0].meta&&item.children[0].meta.icon"
:icon-class=
"item.children[0].meta.icon"
></svg-icon>
<span
v-if=
"item.children[0].meta&&item.children[0].meta.title"
>
{{
item
.
children
[
0
].
meta
.
title
}}
</span>
</el-menu-item>
</router-link>
<el-submenu
v-
if=
"!item.hidden&&item.children&&item.children.length>1"
:index=
"item.name||item.path"
:key=
"item.name"
>
<el-submenu
v-
else
:index=
"item.name||item.path"
:key=
"item.name"
>
<template
slot=
"title"
>
<svg-icon
v-if=
"item.meta&&item.meta.icon"
:icon-class=
"item.meta.icon"
></svg-icon>
<span
v-if=
"item.meta&&item.meta.title"
>
{{
item
.
meta
.
title
}}
</span>
</
template
>
<
template
v-
if=
"!child.hidden"
v-for=
"child in item.childr
en"
>
<
template
v-
for=
"child in item.children"
v-if=
"!child.hidd
en"
>
<sidebar-item
class=
"nest-menu"
v-if=
"child.children&&child.children.length>0"
:routes=
"[child]"
:key=
"child.path"
></sidebar-item>
<router-link
v-else
:to=
"item.path+'/'+child.path"
:key=
"child.name"
>
...
...
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