|
| 1 | +<template> |
| 2 | + <footer class="footer"> |
| 3 | + <div class="footer-left-wrap"> |
| 4 | + <ul class="contact" v-if="contact"> |
| 5 | + <li class="contact-item" v-for="item in contact"> |
| 6 | + <NavLink :link="item.link"> |
| 7 | + <component :is="item.iconComponent"></component> |
| 8 | + {{ item.text }} |
| 9 | + </NavLink> |
| 10 | + </li> |
| 11 | + </ul> |
| 12 | + </div> |
| 13 | + |
| 14 | + <div class="footer-right-wrap"> |
| 15 | + <ul class="copyright" v-if="copyright"> |
| 16 | + <li class="copyright-item" v-for="item in copyright"> |
| 17 | + <NavLink :link="item.link">{{ item.text }}</NavLink> |
| 18 | + </li> |
| 19 | + </ul> |
| 20 | + </div> |
| 21 | + </footer> |
| 22 | +</template> |
| 23 | + |
| 24 | +<script> |
| 25 | + import NavLink from './NavLink' |
| 26 | + import { |
| 27 | + GithubIcon, |
| 28 | + FacebookIcon, |
| 29 | + TwitterIcon, |
| 30 | + } from 'vue-feather-icons' |
| 31 | + |
| 32 | + export default { |
| 33 | + components: { |
| 34 | + NavLink, |
| 35 | + GithubIcon, |
| 36 | + FacebookIcon, |
| 37 | + TwitterIcon, |
| 38 | + }, |
| 39 | + |
| 40 | + methods: { |
| 41 | + getIconComponentName(contactType) { |
| 42 | + switch (contactType) { |
| 43 | + case 'github': |
| 44 | + return 'GithubIcon' |
| 45 | + case 'facebook': |
| 46 | + return 'FacebookIcon' |
| 47 | + case 'twitter': |
| 48 | + return 'TwitterIcon' |
| 49 | + default: |
| 50 | + return '' |
| 51 | + } |
| 52 | + }, |
| 53 | + }, |
| 54 | + |
| 55 | + computed: { |
| 56 | + contact() { |
| 57 | + return ( |
| 58 | + this.$themeConfig.footer && this.$themeConfig.footer.contact || [] |
| 59 | + ) |
| 60 | + .map(({ type, link }) => { |
| 61 | + return { |
| 62 | + iconComponent: this.getIconComponentName(type), |
| 63 | + link, |
| 64 | + } |
| 65 | + }) |
| 66 | + .filter(({ iconComponent }) => iconComponent) |
| 67 | + }, |
| 68 | + |
| 69 | + copyright() { |
| 70 | + return ( |
| 71 | + this.$themeConfig.footer && this.$themeConfig.footer.copyright || [] |
| 72 | + ) |
| 73 | + }, |
| 74 | + }, |
| 75 | + } |
| 76 | +</script> |
| 77 | + |
| 78 | +<style lang="stylus" scoped> |
| 79 | + ol, ul |
| 80 | + list-style none |
| 81 | + margin 0 |
| 82 | + padding 0 |
| 83 | + |
| 84 | + .footer |
| 85 | + height 60px |
| 86 | + box-sizing border-box |
| 87 | + // background-color darken(#3eaf7c, 70%) |
| 88 | + background-color #000 |
| 89 | + color #FFF |
| 90 | + display flex |
| 91 | + padding 15px 32px |
| 92 | + |
| 93 | + .footer-left-wrap |
| 94 | + line-height 30px |
| 95 | + flex 1 |
| 96 | + display flex |
| 97 | + |
| 98 | + .contact |
| 99 | + display flex |
| 100 | + |
| 101 | + .contact-item |
| 102 | + flex 1 |
| 103 | + margin-right 10px |
| 104 | + |
| 105 | + a |
| 106 | + font-size 12px |
| 107 | + color rgba(255, 255, 255, 0.45) |
| 108 | + text-decoration none |
| 109 | + transition color .3s |
| 110 | + |
| 111 | + &:hover |
| 112 | + color #FFF |
| 113 | + |
| 114 | + .footer-right-wrap |
| 115 | + flex 1 |
| 116 | + display flex |
| 117 | + align-items center |
| 118 | + justify-content flex-end |
| 119 | + |
| 120 | + .copyright |
| 121 | + display flex |
| 122 | + justify-content flex-end |
| 123 | + |
| 124 | + .copyright-item |
| 125 | + flex 0 0 auto |
| 126 | + padding 0 10px |
| 127 | + position relative |
| 128 | + line-height 12px |
| 129 | + border-right 1px solid rgba(255, 255, 255, 0.6) |
| 130 | + |
| 131 | + &:last-child |
| 132 | + border-right none |
| 133 | + |
| 134 | + a |
| 135 | + font-size 12px |
| 136 | + color rgba(255, 255, 255, 0.6) |
| 137 | + text-decoration none |
| 138 | + transition color .3s |
| 139 | + |
| 140 | + &:hover |
| 141 | + color rgba(255, 255, 255, 0.9) |
| 142 | + |
| 143 | + @media (max-width: $MQMobile) |
| 144 | + .footer |
| 145 | + height 100px |
| 146 | + flex-direction column |
| 147 | + |
| 148 | + .footer-left-wrap |
| 149 | + align-items center |
| 150 | + justify-content center |
| 151 | +</style> |
0 commit comments