Browse Source

修复代码缺陷

shaojing 5 years ago
parent
commit
f9fd803462
1 changed files with 4 additions and 7 deletions
  1. 4
    7
      src/video/api.js

+ 4
- 7
src/video/api.js View File

@@ -6,14 +6,11 @@
6 6
  */
7 7
 export const togglePause = (videoEl, { paused }) => {
8 8
     const videoTitleEl = document.getElementById("videoTitle")
9
+
10
+    paused ? videoEl.play() : videoEl.pause();
11
+
9 12
     if (videoTitleEl) {
10
-        if (paused) {
11
-            videoEl.play();
12
-            videoTitleEl.style.display = 'none';
13
-        } else {
14
-            videoEl.pause();
15
-            videoTitleEl.style.display = '';
16
-        }
13
+        videoTitleEl.style.display = paused ? 'none' : '';
17 14
     }
18 15
 };
19 16