element/examples/pages/template/component.tpl

141 lines
3.2 KiB
Smarty
Raw Normal View History

2016-11-09 19:15:25 +08:00
<style>
.page-component {
padding-bottom: 95px;
2016-11-18 16:49:07 +08:00
box-sizing: border-box;
2016-11-09 19:15:25 +08:00
.content {
margin-left: -1px;
2016-11-09 19:15:25 +08:00
> {
h3 {
2017-09-28 20:15:00 +08:00
margin: 45px 0 20px;
2016-11-09 19:15:25 +08:00
}
2017-09-28 20:15:00 +08:00
2016-11-09 19:15:25 +08:00
table {
border-collapse: collapse;
width: 100%;
background-color: #fff;
font-size: 14px;
margin-bottom: 45px;
line-height: 1.5em;
2016-11-09 19:15:25 +08:00
strong {
font-weight: normal;
}
2017-09-28 20:15:00 +08:00
td, th {
border-bottom: 1px solid #eaeefb;
padding: 15px;
max-width: 250px;
}
2016-11-09 19:15:25 +08:00
th {
text-align: left;
2016-12-13 22:52:29 +08:00
white-space: nowrap;
2017-09-28 20:15:00 +08:00
color: #666;
font-weight: normal;
2016-11-09 19:15:25 +08:00
}
2017-09-28 20:15:00 +08:00
td {
color: #333;
2016-11-09 19:15:25 +08:00
}
2017-09-28 20:15:00 +08:00
2016-11-09 19:15:25 +08:00
th:first-child, td:first-child {
padding-left: 10px;
}
}
2017-09-28 20:15:00 +08:00
ul:not(.timeline) {
margin: 10px 0;
padding: 0 0 0 20px;
font-size: 14px;
color: #5e6d82;
line-height: 2em;
}
2016-11-09 19:15:25 +08:00
}
}
.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;
}
2016-11-09 19:15:25 +08:00
}
</style>
<template>
<div class="page-container page-component">
<el-row>
2016-11-18 16:49:07 +08:00
<el-col :xs="24" :sm="6">
2016-11-09 19:15:25 +08:00
<side-nav :data="navsData[lang]" :base="`/${ lang }/component`"></side-nav>
</el-col>
2016-11-18 16:49:07 +08:00
<el-col :xs="24" :sm="18">
2016-11-09 19:15:25 +08:00
<router-view class="content"></router-view>
<footer-nav></footer-nav>
</el-col>
</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>
2016-11-09 19:15:25 +08:00
</div>
</template>
<script>
import navsData from '../../nav.config.json';
import throttle from 'throttle-debounce/throttle';
2017-09-28 20:15:00 +08:00
2016-11-09 19:15:25 +08:00
export default {
data() {
return {
lang: this.$route.meta.lang,
navsData,
hover: false,
showBackToTop: false
2016-11-09 19:15:25 +08:00
};
},
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);
2016-11-09 19:15:25 +08:00
}
};
</script>