Browse Source

style: 优化 audio 样式

Allen 4 years ago
parent
commit
8152c74ae6
2 changed files with 9 additions and 2 deletions
  1. 4
    2
      src/components/AudioPlayer/index.js
  2. 5
    0
      src/components/AudioPlayer/index.less

+ 4
- 2
src/components/AudioPlayer/index.js View File

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

+ 5
- 0
src/components/AudioPlayer/index.less View File

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