nebula/components/layouts/pc/main.vue

108 lines
2.5 KiB
Vue
Raw Normal View History

2020-06-19 17:10:44 +08:00
<template>
<el-container>
<el-header>
<header-view/>
</el-header>
<el-main>
2020-08-02 23:55:08 +08:00
<nuxt :nuxt-child-key="$route.name"/>
2020-06-19 17:10:44 +08:00
</el-main>
2020-10-18 17:52:30 +08:00
<el-footer height="5rem">
2020-06-19 17:10:44 +08:00
<footer-view/>
</el-footer>
2020-08-02 23:55:08 +08:00
<div v-if="isPostArticle && isShow" style="position: fixed;bottom: 10vh;right: 3vw;">
<el-col v-if="isPostArticle" :xs="0" :xl="24">
<el-popover
placement="right"
width="20"
trigger="hover">
<el-col>
<el-image :src="gzh"></el-image>
</el-col>
<el-col class="text-center">
<span>扫码关注公众号</span>
</el-col>
<el-button slot="reference" circle><img style="width: 14px;height: 14px;" :src="wx" fit="cover"/>
</el-button>
</el-popover>
</el-col>
<el-col style="padding-top: 1rem;" :xs="0" :xl="24">
<el-button circle @click="backTop" icon="el-icon-caret-top"></el-button>
</el-col>
</div>
2020-06-19 17:10:44 +08:00
</el-container>
</template>
<script>
2020-08-02 23:55:08 +08:00
import {mapState} from 'vuex';
2020-06-19 17:10:44 +08:00
import HeaderView from "./header";
import FooterView from "./footer";
2020-08-02 23:55:08 +08:00
import wx from "~/assets/weixin.png";
import gzh from "~/assets/rymcugzh.jpg";
2020-06-19 17:10:44 +08:00
export default {
name: "PcMain",
components: {
HeaderView,
2020-06-22 17:13:42 +08:00
FooterView
2020-06-21 21:56:34 +08:00
},
computed: {
2020-08-02 23:55:08 +08:00
...mapState('global', []),
isPostArticle() {
if (this.$route.name == 'article-post-article_id') {
return false;
}
return true;
}
},
data() {
return {
isShow: false,
wx: wx,
gzh: gzh
}
},
methods: {
backTop() {
window.scrollTo(0, 0);
},
handleScroll() {
let _ts = this;
let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
if (scrollTop > 100) {
_ts.$set(_ts, 'isShow', true);
} else {
_ts.$set(_ts, 'isShow', false);
}
}
},
mounted() {
window.addEventListener('scroll', this.handleScroll, true);
2020-06-19 17:10:44 +08:00
}
}
</script>
<style scoped>
2020-06-23 17:40:43 +08:00
.el-header {
padding-bottom: 1rem;
background: #fff;
border-bottom: 1px solid rgba(0, 40, 100, 0.12);
z-index: 80;
}
.el-main {
padding: 20px 0;
background-attachment: fixed;
2020-09-21 15:05:10 +08:00
min-height: 87.5vh;
2020-06-23 17:40:43 +08:00
overflow-x: hidden;
}
2020-06-19 17:10:44 +08:00
2020-06-23 17:40:43 +08:00
.el-footer {
2020-09-21 15:05:10 +08:00
position: relative;
2020-06-23 17:40:43 +08:00
width: 100%;
2020-09-21 15:05:10 +08:00
padding-top: 1.2rem;
2020-06-23 17:40:43 +08:00
background: #fff;
border-top: 1px solid rgba(0, 40, 100, 0.12);
z-index: 80;
}
2020-06-19 17:10:44 +08:00
</style>