Ver código fonte

style: 优化 audio 样式

Allen 4 anos atrás
pai
commit
8152c74ae6

+ 4
- 2
src/components/AudioPlayer/index.js Ver arquivo

@@ -37,7 +37,7 @@ class AudioPlayer extends React.Component {
37 37
         });
38 38
       this.player.onpause = () =>
39 39
         this.setState({ isPlaying: false, isLoading: false });
40
-      this.player.onplay = () => this.setState({ isLoading: true });
40
+      // this.player.onplay = () => this.setState({ isLoading: true });
41 41
       this.player.ontimeupdate = event =>
42 42
         this.setState({ currentDuration: event.target.currentTime });
43 43
       this.player.src = src;
@@ -95,7 +95,9 @@ class AudioPlayer extends React.Component {
95 95
     let playIconElem;
96 96
 
97 97
     if (isLoading) {
98
-      playIconElem = <img src={iconLoading} alt="iconLoading" />;
98
+      playIconElem = (
99
+        <img className="icon-loading" src={iconLoading} alt="iconLoading" />
100
+      );
99 101
     } else if (isPlaying) {
100 102
       playIconElem = <Icon className="pause" type="pause" />;
101 103
     } else {

+ 5
- 0
src/components/AudioPlayer/index.less Ver arquivo

@@ -19,6 +19,11 @@
19 19
     font-size: 14px;
20 20
   }
21 21
 
22
+  .icon-loading {
23
+    width: 100%;
24
+    height: 100%;
25
+  }
26
+
22 27
   .slider {
23 28
     margin: 0 0 0 16px;
24 29
     width: 195px;