From 3fb594dc317848107fd7bbb51631cfb763c19f5f Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期三, 05 六月 2024 18:47:03 +0800
Subject: [PATCH] 舞蹈分页

---
 src/components/miniAudio/index.vue |   58 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/src/components/miniAudio/index.vue b/src/components/miniAudio/index.vue
index a014da5..6f9d294 100644
--- a/src/components/miniAudio/index.vue
+++ b/src/components/miniAudio/index.vue
@@ -1,24 +1,62 @@
 <template>
   <div class="mini-audio" v-if="path">
-    <audio controls :src="path"></audio>
+    <audio controls :src="path" class="aduioPlayer"></audio>
   </div>
 </template>
 
 <script>
-  export default {
-    name:"mini-audio",
-    props:{
-      path:{
-        type:String
+export default {
+  name: "mini-audio",
+  props: {
+    path: {
+      type: String,
+    },
+    currentTime: {
+      type: Number,
+    },
+  },
+  watch: {
+    path: {
+      handler(newVal) {
+        if (newVal) {
+          setImmediate(() => {
+            this.play();
+          }, 200);
+        }
+      },
+    },
+  },
+  methods: {
+    play() {
+      const player = (this.container ? this.container : document).querySelector(
+        ".aduioPlayer"
+      );
+      if (player) {
+        player.currentTime = this.currentTime;
+        player.play();
       }
-    }
-  }
+    },
+    getVideoPlayer() {
+      let obj = null;
+      const player = (this.container ? this.container : document).querySelector(
+        ".aduioPlayer"
+      );
+      if (player) {
+        obj = {
+          currentTime: player.currentTime,
+          paused: player.paused,
+        };
+      }
+      return obj
+    },
+  },
+};
 </script>
 
 <style lang="less" scoped>
 .mini-audio {
   position: fixed;
-  right:40px;
+  right: 40px;
   bottom: 100px;
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.1