|
@@ -16,19 +16,19 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
getPlayAudio() {
|
|
|
- if (this.type === 'text') {
|
|
|
- audio.src = this.src
|
|
|
- if (!this.src) {
|
|
|
- this.$message.error('没有找到可播放的资源')
|
|
|
- return false
|
|
|
- }
|
|
|
- this.type = 'delete'
|
|
|
- this.icon = 'el-icon-video-pause'
|
|
|
- audio.play()
|
|
|
+ if (!this.src) {
|
|
|
+ this.$message.error('没有找到可播放的资源')
|
|
|
} else {
|
|
|
- this.type = 'text'
|
|
|
- this.icon = 'el-icon-video-play'
|
|
|
- audio.pause()
|
|
|
+ if (this.type === 'text') {
|
|
|
+ audio.src = this.src
|
|
|
+ this.type = 'delete'
|
|
|
+ this.icon = 'el-icon-video-pause'
|
|
|
+ audio.play()
|
|
|
+ } else {
|
|
|
+ this.type = 'text'
|
|
|
+ this.icon = 'el-icon-video-play'
|
|
|
+ audio.pause()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|