File tree Expand file tree Collapse file tree 3 files changed +102
-2
lines changed Expand file tree Collapse file tree 3 files changed +102
-2
lines changed Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div :class =" {active:isActive}" class =" share-dropdown-menu" >
3
+ <div class =" share-dropdown-menu-wrapper" >
4
+ <span class =" share-dropdown-menu-title" @click.self =" clickTitle" >{{ title }}</span >
5
+ <div v-for =" (item,index) of items" :key =" index" class =" share-dropdown-menu-item" >
6
+ <a v-if =" item.href" :href =" item.href" target =" _blank" >{{ item.title }}</a >
7
+ <span v-else >{{ item.title }}</span >
8
+ </div >
9
+ </div >
10
+ </div >
11
+ </template >
12
+
13
+ <script >
14
+ export default {
15
+ props: {
16
+ items: {
17
+ type: Array ,
18
+ default : function () {
19
+ return []
20
+ }
21
+ },
22
+ title: {
23
+ type: String ,
24
+ default: ' vue'
25
+ }
26
+ },
27
+ data () {
28
+ return {
29
+ isActive: false
30
+ }
31
+ },
32
+ methods: {
33
+ clickTitle () {
34
+ this .isActive = ! this .isActive
35
+ }
36
+ }
37
+ }
38
+ </script >
39
+
40
+ <style lang="scss" >
41
+ $n : 8 ; // 和items.length 相同
42
+ $t : .1s ;
43
+ .share-dropdown-menu {
44
+ width : 250px ;
45
+ position : relative ;
46
+ z-index : 1 ;
47
+ & -title {
48
+ width : 100% ;
49
+ display : block ;
50
+ cursor : pointer ;
51
+ background : black ;
52
+ color : white ;
53
+ height : 60px ;
54
+ line-height : 60px ;
55
+ font-size : 20px ;
56
+ text-align : center ;
57
+ z-index : 2 ;
58
+ transform : translate3d (0 ,0 ,0 );
59
+ }
60
+ & -wrapper {
61
+ position : relative ;
62
+ }
63
+ & -item {
64
+ text-align : center ;
65
+ position : absolute ;
66
+ width : 100% ;
67
+ background : #e0e0e0 ;
68
+ line-height : 60px ;
69
+ height : 60px ;
70
+ cursor : pointer ;
71
+ font-size : 20px ;
72
+ opacity : 1 ;
73
+ transition : transform 0.28s ease ;
74
+ & :hover {
75
+ background : black ;
76
+ color : white ;
77
+ }
78
+ @for $i from 1 through $n {
79
+ & :nth-of-type (#{$i } ) {
80
+ z-index : -1 ;
81
+ transition-delay : $i * $t ;
82
+ transform : translate3d (0 , -60px , 0 );
83
+ }
84
+ }
85
+ }
86
+ & .active {
87
+ .share-dropdown-menu-wrapper {
88
+ z-index : 1 ;
89
+ }
90
+ .share-dropdown-menu-item {
91
+ @for $i from 1 through $n {
92
+ & :nth-of-type (#{$i } ) {
93
+ transition-delay : ($n - $i )* $t ;
94
+ transform : translate3d (0 , ($i - 1 )* 60px , 0 );
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ </style >
Original file line number Diff line number Diff line change 115
115
import PanThumb from ' @/components/PanThumb'
116
116
import MdInput from ' @/components/MDinput'
117
117
import Mallki from ' @/components/TextHoverEffect/Mallki'
118
- import DropdownMenu from ' @/components/Share/dropdownMenu '
118
+ import DropdownMenu from ' @/components/Share/DropdownMenu '
119
119
import waves from ' @/directive/waves/index.js' // 水波纹指令
120
120
121
121
export default {
Original file line number Diff line number Diff line change 7
7
</div >
8
8
</template >
9
9
<script >
10
- import DropdownMenu from ' @/components/Share/dropdownMenu '
10
+ import DropdownMenu from ' @/components/Share/DropdownMenu '
11
11
12
12
export default {
13
13
name: ' Documentation' ,
You can’t perform that action at this time.
0 commit comments