-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathPickerPoints.vue
81 lines (76 loc) · 1.5 KB
/
PickerPoints.vue
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
<template lang="pug">
div(':style'="inlineStyle" '@click'="handleTimeChange(index,angle)" class="picker-point" ':class'="[pointClass,{current:picked}]")
div(class="pointer-wrapper" ':style'="wrapperStyle") {{index}}
</template>
<script>
export default {
props: {
index: {
type: Number,
},
angle: {
type: Number
},
handleTimeChange: {
type: Function,
required: true,
default: () => {}
},
pointClass: {
type: String,
default: 'point-outter'
},
picked: {
type: Boolean,
default: false
}
},
methods: {
getInlineRotateStyle(degree) {
return {
transform: `translateX(-50%) rotate(${degree}deg)`
}
},
getRotateStyle(degree) {
return {
transform: `rotate(${degree}deg)`
}
}
},
computed: {
inlineStyle() {
return this.getInlineRotateStyle(this.angle)
},
wrapperStyle() {
return this.getRotateStyle(-this.angle)
}
}
}
</script>
<style lang="css">
.picker-point {
left: 50%;
cursor: pointer;
position: absolute;
width: 30px;
height: 30px;
text-align: center;
line-height: 30px;
border-radius: 50%;
}
.picker-point.current{
background-color:#3498db;
color:#fff !important;
transition: all 400ms cubic-bezier(0.165, 0.84, 0.44, 1);
}
.picker-point.point-outter {
top: 10px;
color: #5f5f5f;
transform-origin: center 115px;
}
.picker-point.point-inner {
top: 40px;
color: #a7a7a7;
transform-origin: center 90px;
}
</style>