Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
d3d2e625
Commit
d3d2e625
authored
Sep 08, 2016
by
FuryBean
Committed by
GitHub
Sep 08, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #38 from Leopoldthecoder/master
use hash
parents
65d6938d
f7cc340f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
39 deletions
+21
-39
examples/app.vue
examples/app.vue
+6
-1
examples/components/footer.vue
examples/components/footer.vue
+11
-9
examples/entry.js
examples/entry.js
+1
-20
examples/route.config.js
examples/route.config.js
+2
-8
src/utils/vue-popper.js
src/utils/vue-popper.js
+1
-1
No files found.
examples/app.vue
View file @
d3d2e625
...
@@ -81,6 +81,11 @@
...
@@ -81,6 +81,11 @@
<
script
>
<
script
>
export
default
{
export
default
{
name
:
'
app
'
name
:
'
app
'
,
created
()
{
window
.
addEventListener
(
'
hashchange
'
,
()
=>
{
document
.
body
.
scrollTop
=
0
;
});
}
};
};
</
script
>
</
script
>
examples/components/footer.vue
View file @
d3d2e625
<
template
>
<
template
>
<footer
class=
"footer"
>
<footer
class=
"footer"
>
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"footer-main"
>
<div
class=
"footer-main"
>
<p
class=
"footer-main-title"
>
Element 1.0 Hydrogen
</p>
<p
class=
"footer-main-title"
>
Element 1.0 Hydrogen
</p>
<span
class=
"footer-main-link"
>
反馈建议
</span>
<span
class=
"footer-main-link"
>
反馈建议
</span>
<span
class=
"footer-main-link"
><router-link
to=
"/changelog"
>
更新日志
</router-link></span>
<span
class=
"footer-main-link"
><router-link
to=
"/changelog"
>
更新日志
</router-link></span>
</div>
</div>
<div
class=
"footer-social"
>
<div
class=
"footer-social"
>
<el-popover
<el-popover
ref=
"weixin"
ref=
"weixin"
...
@@ -72,10 +72,12 @@
...
@@ -72,10 +72,12 @@
line-height
:
120px
;
line-height
:
120px
;
.footer-popover
{
.footer-popover
{
padding
:
0
;
.el-popover
{
min-width
:
120px
;
padding
:
0
;
line-height
:
normal
;
min-width
:
120px
;
box-shadow
:
0
0
11px
0
rgba
(
174
,
187
,
211
,
0.24
);
line-height
:
normal
;
box-shadow
:
0
0
11px
0
rgba
(
174
,
187
,
211
,
0.24
);
}
.footer-popover-title
{
.footer-popover-title
{
border-bottom
:
solid
1px
#eaeefb
;
border-bottom
:
solid
1px
#eaeefb
;
...
...
examples/entry.js
View file @
d3d2e625
...
@@ -18,28 +18,9 @@ Vue.component('main-header', MainHeader);
...
@@ -18,28 +18,9 @@ Vue.component('main-header', MainHeader);
Vue
.
component
(
'
side-nav
'
,
SideNav
);
Vue
.
component
(
'
side-nav
'
,
SideNav
);
Vue
.
component
(
'
footer-nav
'
,
FooterNav
);
Vue
.
component
(
'
footer-nav
'
,
FooterNav
);
const
scrollBehavior
=
(
to
,
from
,
savedPosition
)
=>
{
if
(
savedPosition
)
{
// savedPosition is only available for popstate navigations.
return
savedPosition
;
}
else
{
// new navigation.
// scroll to anchor
if
(
to
.
hash
)
{
return
{
anchor
:
true
};
}
// explicitly control scroll position
// check if any matched route config has meta that requires scrolling to top
if
(
to
.
matched
.
some
(
m
=>
m
.
meta
.
scrollToTop
))
{
return
{
x
:
0
,
y
:
0
};
}
}
};
const
router
=
new
VueRouter
({
const
router
=
new
VueRouter
({
mode
:
'
h
istory
'
,
mode
:
'
h
ash
'
,
base
:
__dirname
,
base
:
__dirname
,
scrollBehavior
,
routes
:
configRouter
routes
:
configRouter
});
});
...
...
examples/route.config.js
View file @
d3d2e625
...
@@ -4,8 +4,7 @@ const registerRoute = (config) => {
...
@@ -4,8 +4,7 @@ const registerRoute = (config) => {
let
route
=
[{
let
route
=
[{
path
:
'
/component
'
,
path
:
'
/component
'
,
component
:
require
(
'
./pages/component.vue
'
),
component
:
require
(
'
./pages/component.vue
'
),
children
:
[],
children
:
[]
scrollToTop
:
true
}];
}];
function
addRoute
(
page
)
{
function
addRoute
(
page
)
{
const
component
=
require
(
`./docs
${
page
.
path
}
.md`
);
const
component
=
require
(
`./docs
${
page
.
path
}
.md`
);
...
@@ -14,8 +13,7 @@ const registerRoute = (config) => {
...
@@ -14,8 +13,7 @@ const registerRoute = (config) => {
path
:
page
.
path
.
slice
(
1
),
path
:
page
.
path
.
slice
(
1
),
meta
:
{
meta
:
{
title
:
page
.
title
||
page
.
name
,
title
:
page
.
title
||
page
.
name
,
description
:
page
.
description
,
description
:
page
.
description
scrollToTop
:
true
},
},
component
:
component
.
default
||
component
component
:
component
.
default
||
component
});
});
...
@@ -45,7 +43,6 @@ let guideRoute = {
...
@@ -45,7 +43,6 @@ let guideRoute = {
path
:
'
/guide
'
,
path
:
'
/guide
'
,
name
:
'
指南
'
,
name
:
'
指南
'
,
component
:
require
(
'
./pages/guide.vue
'
),
component
:
require
(
'
./pages/guide.vue
'
),
meta
:
{
scrollToTop
:
true
},
children
:
[{
children
:
[{
path
:
'
design
'
,
path
:
'
design
'
,
name
:
'
设计原则
'
,
name
:
'
设计原则
'
,
...
@@ -60,20 +57,17 @@ let guideRoute = {
...
@@ -60,20 +57,17 @@ let guideRoute = {
let
resourceRoute
=
{
let
resourceRoute
=
{
path
:
'
/resource
'
,
path
:
'
/resource
'
,
name
:
'
资源
'
,
name
:
'
资源
'
,
meta
:
{
scrollToTop
:
true
},
component
:
require
(
'
./pages/resource.vue
'
)
component
:
require
(
'
./pages/resource.vue
'
)
};
};
let
indexRoute
=
{
let
indexRoute
=
{
path
:
'
/
'
,
path
:
'
/
'
,
name
:
'
首页
'
,
name
:
'
首页
'
,
meta
:
{
scrollToTop
:
true
},
component
:
require
(
'
./pages/index.vue
'
)
component
:
require
(
'
./pages/index.vue
'
)
};
};
let
changeLogRoute
=
{
let
changeLogRoute
=
{
path
:
'
/changelog
'
,
path
:
'
/changelog
'
,
meta
:
{
scrollToTop
:
true
},
component
:
require
(
'
./pages/changelog.vue
'
)
component
:
require
(
'
./pages/changelog.vue
'
)
};
};
...
...
src/utils/vue-popper.js
View file @
d3d2e625
...
@@ -63,7 +63,7 @@ export default {
...
@@ -63,7 +63,7 @@ export default {
const
options
=
this
.
options
;
const
options
=
this
.
options
;
const
popper
=
this
.
popper
||
this
.
$refs
.
popper
;
const
popper
=
this
.
popper
||
this
.
$refs
.
popper
;
const
reference
=
this
.
reference
||
this
.
$refs
.
reference
||
this
.
$slots
.
reference
[
0
].
elm
;
;
const
reference
=
this
.
reference
||
this
.
$refs
.
reference
||
this
.
$slots
.
reference
[
0
].
elm
;
if
(
!
popper
||
!
reference
)
return
;
if
(
!
popper
||
!
reference
)
return
;
if
(
this
.
visibleArrow
)
{
if
(
this
.
visibleArrow
)
{
...
...
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