| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <template>
- <div class="site-bar">
- <div class="btn wechat">
- <svg-icon icon-class="wechat" />
- <img class="show-img" :src="wechatSrc" alt="">
- </div>
- <div class="btn top" @click="toTop" >
- <svg-icon icon-class="top" />
- </div>
- </div>
- </template>
- <script>
- // 网页侧边栏小工具
- export default {
- name: "siteBar",
- props:{
- lang: {
- type: String,
- default: 'cn'
- },
- wechatSrc: {
- type: String,
- default: ''
- }
- },
- methods: {
- toTop() {
- // 缓慢移动到顶部
- window.scrollTo({
- top: 0,
- behavior: "smooth"
- });
- }
- }
- }
- </script>
- <style scoped>
- .site-bar{
- width: 50px;
- height: auto;
- position: fixed;
- right: 180px;
- top: 70%;
- transform: translateY(-50%);
- }
- .site-bar .btn{
- width: 50px;
- height: 50px;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 2rem;
- cursor: pointer;
- background-color: #f5f5f5;
- border-radius: 50%;
- box-shadow: 0 0 5px #dedede;
- color: #999999;
- margin-bottom: 10px;
- }
- .site-bar .btn:hover{
- background-color: #dedede;
- color: #af4141;
- }
- .wechat{
- position: relative;
- }
- .wechat .show-img{
- position: absolute;
- bottom: 50px;
- right: 50px;
- display: block;
- width: 0;
- height: 0;
- max-width: none;
- border-radius: 5px;
- box-shadow: 1px 1px 7px 5px #dedede;
- opacity: 0;
- transition: all 0.5s;
- }
- .wechat:hover .show-img{
- opacity: 1;
- width: 180px;
- height: 180px;
- }
- </style>
|