liyongli 1 жил өмнө
parent
commit
bfb12e11ab

+ 10 - 4
src/components/playBtn.vue

@@ -74,11 +74,17 @@ const play = () => {
     audio.pause();
   }
 };
+let a = 0;
+const touchendfunc = () => {
+  if (a === 1) {
+    document.removeEventListener('touchend',touchendfunc);
+    return;
+  }
+  audio && audio.play();
+  a = 1;
+};
 
-document.addEventListener('touchend' , ()=>{
-    audio && audio.play();
-})
-
+document.addEventListener('touchend', touchendfunc);
 </script>
 <style scoped>
 .imgbtn {