Browse Source

Merge branch 'iteration-upload-works'

lex 1 year ago
parent
commit
78cddd3325
1 changed files with 14 additions and 1 deletions
  1. 14 1
      src/views/creation/index.tsx

+ 14 - 1
src/views/creation/index.tsx

@@ -1,4 +1,4 @@
-import { defineComponent, onMounted, reactive } from 'vue';
+import { defineComponent, onMounted, onUnmounted, reactive } from 'vue';
 // import WaveSurfer from 'wavesurfer.js';
 import styles from './index.module.less';
 import MSticky from '@/components/m-sticky';
@@ -257,10 +257,23 @@ export default defineComponent({
             initAudio();
           });
         }
+
+        window.addEventListener('pagehide', () => {
+          console.log(1111);
+          // if (audioDom) {
+          //   audioDom.pause();
+          // }
+        });
       } catch {
         //
       }
     });
+
+    onUnmounted(() => {
+      if (audioDom) {
+        audioDom.pause();
+      }
+    });
     return () => (
       <div class={styles.creation}>
         <MSticky position="top">