| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <template>
- <div class="mobile-footer">
- <span :class="activeType=='home'?'active':''">
- <nuxt-link to="/">
- <i :class="activeType=='home'?'iconfont icon-shouye':'iconfont icon-shouye1'"></i><p>首页</p>
- </nuxt-link>
- </span>
- <span :class="activeType=='shops'?'active':''">
- <nuxt-link to="/mobile/shop">
- <i :class="activeType=='shops'?'iconfont icon-dianpu':'iconfont icon-dianpu1'"></i><p>店铺</p>
- </nuxt-link>
- </span>
- <span :class="activeType=='user'?'active':''">
- <nuxt-link to="/mobile/user">
- <i :class="activeType=='user'?'iconfont icon-icon':'iconfont icon-wo'"></i><p>我</p>
- </nuxt-link>
- </span>
- <a @click="toTop" v-show="!hideToTop"><i class="iconfont icon-arrow-up icon-xlg"></i></a>
- </div>
- </template>
- <script>
- import { scrollTo } from '~utils/scroll'
- export default{
- name: 'MobileFooter',
- data () {
- return {
- hideToTop: true
- }
- },
- computed: {
- activeType () {
- return this.$route.path === '/' ? 'home' : this.$route.path === '/mobile/shop' ? 'shops' : this.$route.path === '/mobile/user' ? 'user' : ''
- }
- },
- mounted: function () {
- this.$nextTick(function () {
- window.addEventListener('scroll', this.onScroll)
- })
- },
- methods: {
- onScroll () {
- let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
- if (scrolled > window.screen.availHeight) {
- this.hideToTop = false
- } else {
- this.hideToTop = true
- }
- },
- toTop () {
- scrollTo('body', 300)
- }
- }
- }
- </script>
- <style scoped>
- .mobile-footer{
- position:fixed;
- bottom:0;
- width:100%;
- height:.98rem;
- text-align: center;
- border-top:.04rem solid #ccc;
- background: #ffffff;
- z-index: 10;
- }
- .mobile-footer span{
- display: inline-block;
- width: 2.5rem;
- font-size:.32rem;
- color:#b0b0b0;
- padding-top:.1rem;
- }
- .mobile-footer span a{
- color:#b0b0b0;
- }
- .mobile-footer span a i{
- font-size:.45rem;
- }
- .mobile-footer span a p{
- font-size:.22rem;
- }
- .mobile-footer span.active a{
- color:#3976f4;
- }
- .mobile-footer >a {
- position: absolute;
- right: .1rem;
- top: -1rem;
- background: rgba(0,0,0,.4);
- color: #fff;
- width: .88rem;
- height: .88rem;
- line-height: .88rem;
- border-radius: 100%;
- }
- .mobile-footer >a i{
- font-size: .46rem;
- }
- </style>
|