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
<template>
<div>
<el-button
@click="dialogToggle"
size="mini" type="primary" plain>录音</el-button>
<el-dialog title="录音播放" append-to-body :visible.sync="dialog.show" width="500px">
<audio ref="recordAudio" style="display: block; width: 100%;" :src="src" controls preload="metadata"></audio>
</el-dialog>
</div>
</template>
<script>
export default {
name: "PhoneRecord",
props: {
src: {
type: String,
required: true
}
},
data() {
return {
dialog: {
show: false
}
}
},
watch: {
'dialog.show'(value) {
if (!value) {
this.$refs['recordAudio'].pause()
}
}
},
methods: {
dialogToggle() {
this.dialog.show = !this.dialog.show;
}
}
}
</script>
<style>
</style>