Skip to content

Commit 6a8379f

Browse files
committed
dropdownMenu => DropdownMenu
1 parent 123c32c commit 6a8379f

File tree

3 files changed

+102
-2
lines changed

3 files changed

+102
-2
lines changed

src/components/Share/DropdownMenu.vue

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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>

src/views/components-demo/mixin.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
import PanThumb from '@/components/PanThumb'
116116
import MdInput from '@/components/MDinput'
117117
import Mallki from '@/components/TextHoverEffect/Mallki'
118-
import DropdownMenu from '@/components/Share/dropdownMenu'
118+
import DropdownMenu from '@/components/Share/DropdownMenu'
119119
import waves from '@/directive/waves/index.js' // 水波纹指令
120120
121121
export default {

src/views/documentation/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</div>
88
</template>
99
<script>
10-
import DropdownMenu from '@/components/Share/dropdownMenu'
10+
import DropdownMenu from '@/components/Share/DropdownMenu'
1111
1212
export default {
1313
name: 'Documentation',

0 commit comments

Comments
 (0)