Arrow.vue
2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<template>
<div>
<!-- 左箭头 开始 -->
<div class="left_arrow" v-if="current > 0">
<div class="arrow_inner" @click="leftClickEvent">
<img src="@/assets/images/arrow_left.png" class="img" alt="" />
<img src="@/assets/images/arrow_circle.png" class="circle" alt="" />
</div>
</div>
<!-- 左箭头 end -->
<!-- 右箭头 开始 -->
<div class="right_arrow">
<div class="arrow_inner" @click="rightClickEvent">
<img src="@/assets/images/arrow_right.png" class="img" alt="" />
<img src="@/assets/images/arrow_circle.png" class="circle" alt="" />
</div>
</div>
<!-- 右箭头 end -->
</div>
</template>
<script>
export default {
name: 'FixedArrow',
props: {
current: {
type: [Number, String],
default: 0
}
},
data() {
return {
leftCircle: '',
rightCircle: ''
}
},
methods: {
// 左侧箭头点击事件
leftClickEvent() {
this.$emit('prev')
},
// 右侧箭头点击事件
rightClickEvent() {
this.$emit('next')
}
}
}
</script>
<style lang="scss" scoped>
.left_arrow,
.right_arrow {
position: fixed;
top: 0;
bottom: 0;
z-index: 10;
width: 100px;
.arrow_inner {
position: fixed;
width: 100px;
height: 50vh;
top: 50%;
transform: translateY(-50%);
z-index: 99;
cursor: pointer;
}
.img {
width: 48px;
height: 48px;
opacity: 0;
cursor: pointer;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.circle {
width: 84px;
height: 84px;
position: absolute;
top: 50%;
// transform: translateY(-50%);
margin-top: -42px;
z-index: 98;
opacity: 0;
}
}
.left_arrow {
left: 0;
.img {
left: 18px;
}
.circle {
left: 0;
}
}
.right_arrow {
right: 0;
.img {
right: 18px;
}
.circle {
right: 0;
}
}
.left_arrow:hover,
.right_arrow:hover {
.img {
opacity: 1;
}
.circle {
opacity: 1;
animation: rotate360 1.2s ease-out 0s;
}
// .circleAnimate{
// opacity: 1;
// animation: rotate360 1.2s ease-out 0s;
// }
}
@keyframes rotate360 {
100% {
transform: rotate(360deg);
}
}
</style>