|
@@ -1,5 +1,5 @@
|
|
|
import { Icon } from 'vant'
|
|
|
-import { defineComponent, reactive } from 'vue'
|
|
|
+import { defineComponent, onUnmounted, reactive } from 'vue'
|
|
|
import styles from './index.module.less'
|
|
|
import { Howl } from 'howler'
|
|
|
import iconAudio from './images/icon-audio.png'
|
|
@@ -46,6 +46,9 @@ export default defineComponent({
|
|
|
state.audioStatus = 'stopped'
|
|
|
})
|
|
|
|
|
|
+ onUnmounted(() => {
|
|
|
+ htick.off('load')
|
|
|
+ })
|
|
|
return () => (
|
|
|
<div class={styles.unitAudio}>
|
|
|
<div class={styles.htmlAudio}>
|
|
@@ -58,7 +61,8 @@ export default defineComponent({
|
|
|
<Icon
|
|
|
name={state.audioStatus === 'stopped' ? 'play-circle' : 'pause-circle'}
|
|
|
class={styles.audioStatus}
|
|
|
- onClick={() => {
|
|
|
+ onClick={(e: any) => {
|
|
|
+ e.stopPropagation()
|
|
|
if (state.audioStatus === 'stopped') {
|
|
|
eventUnit.emit('unitAudioStop')
|
|
|
htick.play()
|