DESKTOP-SVI9JE1\muzen 2 роки тому
батько
коміт
020500024e
1 змінених файлів з 12 додано та 12 видалено
  1. 12 12
      src/components/Audio/index.vue

+ 12 - 12
src/components/Audio/index.vue

@@ -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()
+        }
       }
     }
   }