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
| <template>
| <view class="uni-audio" @click="clickPlay">
| <view style="font-size: 18px; margin-right: 8px;"
| :class="[{'play-other':(playingSrc== audioSrc )},'fu-shengyin','play-icon']">
| </view>
| <view>{{audioLen > 0 ? audioLen + "''" :""}}</view>
| </view>
| </template>
|
| <script>
| export default {
| name: "audio",
| emits: ['playVoice'],
| props: {
| audioSrc: {
| type: String,
| default () {
| return "";
| }
| },
| audioLen: {
| type: Number,
| default () {
| return 0;
| }
| },
| playingSrc: {
| type: String,
| default () {
| return "";
| }
| },
| },
| data() {
| return {}
| },
| methods: {
| clickPlay() {
| this.$emit('playVoice')
| }
| },
| }
| </script>
|
| <style lang="less">
| .uni-audio {
| display: flex;
| flex-direction: row;
|
| @keyframes my-play {
| 0% {
| transform: translateX(80%);
| }
|
| 100% {
| transform: translateX(0%); // rotate(180deg)
| }
| }
|
| .play-my::after {
| width: 50rpx;
| height: 50rpx;
| border-radius: 100%;
| box-sizing: border-box;
| position: absolute;
| border-left: solid 10rpx rgba(0, 170, 255, .8);
| animation: my-play 1s linear infinite;
| content: " ";
| }
|
| @keyframes other-play {
| 0% {
| transform: translateX(-80%);
| }
|
| 100% {
| transform: translateX(0%);
| }
| }
|
| .play-icon {
| display: flex;
| align-items: center;
| }
|
| .play-other::after {
| width: 50rpx;
| height: 50rpx;
| border-radius: 100%;
| box-sizing: border-box;
| position: absolute;
| content: " ";
| border-right: solid 10rpx rgba(240, 240, 240, .8);
| animation: other-play 1s linear infinite;
|
| }
|
|
| }
| </style>
|
|