11<template >
22 <div class =" friend-link-wrapper" >
3- <a
3+ <div
4+ class =" friend-link-item"
45 v-for =" (item, index) in $themeConfig.friendLink"
56 :key =" index"
6- :href =" item.link"
7+ @mouseenter =" showDetail($event, item)"
8+ @mouseleave =" hideDetail"
79 target =" _blank" >
810 <span
911 class =" list-style"
1012 :style =" { 'backgroundColor': _tagColor() }" >
1113 </span >
1214 {{item.title}}
13- </a >
15+ </div >
16+ <div @mouseenter =" showDetailStatus = true" class =" popup-window" v-if =" showDetailStatus" :style =" popupWindowStyle" ref =" popupWindow" >
17+ <div class =" avatar" >
18+ <img :src =" `http://1.gravatar.com/avatar/${getMd5('recoluan@qq.com' || '')}?s=50& ; d=mm& ; r=x`" />
19+ </div >
20+ <div class =" info" >
21+ <div class =" title" >
22+ <h4 >{{ detailData.title }}</h4 >
23+ <a
24+ class =" btn-go"
25+ :style =" { 'backgroundColor': _tagColor() }"
26+ :href =" detailData.link"
27+ target =" _blank" >GO</a >
28+ </div >
29+ <p >Enjoy when you can, and endure when you must.</p >
30+ </div >
31+ </div >
1432 </div >
1533</template >
1634
1735<script >
36+ import md5 from ' md5'
1837import mixin from ' @theme/mixins/index.js'
1938
2039export default {
21- mixins: [mixin]
40+ mixins: [mixin],
41+ data () {
42+ return {
43+ detailData: {},
44+ showDetailStatus: false ,
45+ popupWindowStyle: {}
46+ }
47+ },
48+ methods: {
49+ getMd5 (str ) {
50+ return md5 (str)
51+ },
52+ showDetail (e , info ) {
53+ const currentDom = e .target
54+ const { offsetTop , offsetLeft , clientWidth , clientHeight } = currentDom
55+ console .log (clientWidth)
56+ const { offsetX , offsetY } = e
57+ this .popupWindowStyle = {
58+ left: ((offsetLeft + clientWidth) - 300 ) / 2 + ' px' ,
59+ top: ((offsetTop + clientHeight) / 2 ) - 155 + ' px'
60+ }
61+ this .detailData = info
62+ this .showDetailStatus = true
63+ },
64+ hideDetail () {
65+ this .showDetailStatus = false
66+ this .detailData = {}
67+ }
68+ }
2269}
2370 </script >
2471
2572<style lang="stylus" scoped>
2673@require '../styles/recoConfig.styl'
2774
2875.friend-link-wrapper
76+ position relative
2977 margin 30px 0
30- > a
78+ .friend-link-item
3179 position relative
3280 vertical-align : middle ;
3381 margin : 4px 4px 10px ;
3482 padding : 4px 8px 4px 20px ;
83+ line-height 20px
3584 display : inline-block ;
3685 cursor : pointer ;
3786 border-radius : $borderRadius
@@ -51,6 +100,40 @@ export default {
51100 border-radius .1rem
52101 background $accentColor
53102 content ''
54- & :hover
55- transform scale (1.04 )
103+ .popup-window
104+ position absolute
105+ display flex
106+ background #ff ff ff
107+ box-shadow $boxShadow
108+ box-sizing border-box
109+ padding .4rem
110+ width 300px
111+ height 150px
112+ .avatar
113+ margin-right .4rem
114+ width 2rem
115+ height 2rem
116+ border-radius $borderRadius
117+ overflow hidden
118+ img
119+ width 2rem
120+ height 2rem
121+ .info
122+ flex 1
123+ .title
124+ display flex
125+ align-items center
126+ justify-content space-between
127+ height 2rem
128+ h4
129+ margin .2rem 0
130+ .btn-go
131+ width 1.4rem
132+ height 1.2rem
133+ border-radius $borderRadius
134+ font-size .1rem
135+ color #ff ff ff
136+ text-align center
137+ line-height 1.2rem
138+ cursor pointer
56139 </style >
0 commit comments