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
d0ce16a8
Commit
d0ce16a8
authored
Mar 06, 2017
by
杨奕
Committed by
cinwell.li
Mar 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Doc: add back-to-top icon in components page (#3279)
parent
cdc482c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
8 deletions
+109
-8
examples/pages/template/component.tpl
examples/pages/template/component.tpl
+59
-3
src/utils/date.js
src/utils/date.js
+25
-0
src/utils/resize-event.js
src/utils/resize-event.js
+25
-5
No files found.
examples/pages/template/component.tpl
View file @
d0ce16a8
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
.page-component
{
.page-component
{
padding-bottom
:
95px
;
padding-bottom
:
95px
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
}
.page-component
{
.content
{
.content
{
margin-left
:
-1px
;
margin-left
:
-1px
;
...
@@ -39,6 +37,32 @@
...
@@ -39,6 +37,32 @@
}
}
}
}
}
}
.page-component-up
{
background-color
:
#58b7ff
;
position
:
fixed
;
right
:
100px
;
bottom
:
150px
;
size
:
50px
;
border-radius
:
25px
;
cursor
:
pointer
;
opacity
:
0.4
;
transition
:
.3s
;
i
{
color
:
#fff
;
display
:
block
;
line-height
:
50px
;
text-align
:
center
;
font-size
:
22px
;
}
&
.hover
{
opacity
:
1
;
}
}
.back-top-fade-enter
,
.back-top-fade-leave-active
{
transform
:
translateY
(
-30px
);
opacity
:
0
;
}
}
}
</style>
</style>
<template>
<template>
...
@@ -52,16 +76,48 @@
...
@@ -52,16 +76,48 @@
<footer-nav></footer-nav>
<footer-nav></footer-nav>
</el-col>
</el-col>
</el-row>
</el-row>
<transition
name=
"back-top-fade"
>
<div
class=
"page-component-up"
:class=
"{ 'hover': hover }"
v-show=
"showBackToTop"
@
mouseenter=
"hover = true"
@
mouseleave=
"hover = false"
@
click=
"toTop"
>
<i
class=
"el-icon-caret-top"
></i>
</div>
</transition>
</div>
</div>
</template>
</template>
<script>
<script>
import
navsData
from
'
../../nav.config.json
'
;
import
navsData
from
'
../../nav.config.json
'
;
import
throttle
from
'
throttle-debounce/throttle
'
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
lang
:
this
.
$route
.
meta
.
lang
,
lang
:
this
.
$route
.
meta
.
lang
,
navsData
navsData
,
hover
:
false
,
showBackToTop
:
false
};
};
},
methods
:
{
toTop
()
{
this
.
hover
=
false
;
this
.
showBackToTop
=
false
;
document
.
body
.
scrollTop
=
0
;
document
.
documentElement
.
scrollTop
=
0
;
},
handleScroll
()
{
this
.
showBackToTop
=
(
document
.
body
.
scrollTop
||
document
.
documentElement
.
scrollTop
)
>=
0.5
*
document
.
body
.
clientHeight
;
}
},
mounted
()
{
this
.
throttledScrollHandler
=
throttle
(
300
,
this
.
handleScroll
);
document
.
addEventListener
(
'
scroll
'
,
this
.
throttledScrollHandler
);
},
beforeDestroy
()
{
document
.
removeEventListener
(
'
scroll
'
,
this
.
throttledScrollHandler
);
}
}
};
};
</script>
</script>
src/utils/date.js
View file @
d0ce16a8
/* Modified from https://github.com/taylorhakes/fecha
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Taylor Hakes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*eslint-disable*/
/*eslint-disable*/
// 把 YYYY-MM-DD 改成了 yyyy-MM-dd
// 把 YYYY-MM-DD 改成了 yyyy-MM-dd
(
function
(
main
)
{
(
function
(
main
)
{
...
...
src/utils/resize-event.js
View file @
d0ce16a8
/**
/* Modified from https://github.com/sdecima/javascript-detect-element-resize
* Modified from https://github.com/sdecima/javascript-detect-element-resize
* version: 0.5.3
*
*
* version: 0.5.3
* The MIT License (MIT)
**/
*
* Copyright (c) 2013 Sebastián Décima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
const
isServer
=
typeof
window
===
'
undefined
'
;
const
isServer
=
typeof
window
===
'
undefined
'
;
/* istanbul ignore next */
/* istanbul ignore next */
...
...
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