speedview.vue
1.7 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
<template>
<view class="speed-wrap-box" @click="speedbgTap" v-show="show">
<view :class="showAnim ? 'speed-info-box speed-info-box-show' : 'speed-info-box'">
<template v-for="(speedItem, speedIndex) in speedList">
<text :key="speedIndex" :class="curIndex === speedIndex ? 'speed-item-txt active':'speed-item-txt'" @click="speedItemClick(speedIndex)"> {{speedItem}} </text>
</template>
</view>
</view>
</template>
<script>
export default {
name: 'SpeedView',
data (){
return {
show: false,
showAnim: false,
speedList: [0.5, 1.0, 1.25, 1.5, 2.0],
curIndex: 1
}
},
methods: {
setShow: function () {
this.show = true
setTimeout(() => {
this.showAnim = true
})
},
setHiden: function () {
this.showAnim = false
setTimeout(() => {
this.show = false
}, 300)
},
speedbgTap: function (e) {
this.setHiden()
},
speedItemClick: function (index){
this.curIndex = index
this.$emit('speedChange', this.speedList[this.curIndex])
this.setHiden()
}
}
}
</script>
<style scoped>
.speed-info-box{
height: 100%;
width: 300rpx;
background: rgba(0, 0, 0, 0.5);
position: absolute;
right: -300px;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
color: white;
font-size: 10pt;
transition: right 0.3s linear 0s;
}
.speed-wrap-box{
pointer-events: all;
width: 100%;
height: 100%;
}
.speed-item-txt{
color: #fff;
font-size: 10pt;
padding: 10rpx;
}
.active{
color: #12d2f6;
}
.speed-info-box-show{
right: 0px;
}
</style>