File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ class APlayer {
6262 this . template = new Template ( {
6363 container : this . container ,
6464 options : this . options ,
65+ randomOrder : this . randomOrder ,
6566 } ) ;
6667
6768 if ( this . template . info . offsetWidth < 200 ) {
Original file line number Diff line number Diff line change @@ -5,13 +5,23 @@ class Template {
55 constructor ( options ) {
66 this . container = options . container ;
77 this . options = options . options ;
8+ this . randomOrder = this . randomOrder ;
89 this . init ( ) ;
910 }
1011
1112 init ( ) {
13+ let pic ;
14+ if ( this . options . order === 'random' ) {
15+ pic = this . options . music [ this . randomOrder [ 0 ] ] . pic ;
16+ }
17+ else {
18+ pic = this . options . music [ 0 ] . pic ;
19+ }
20+
1221 this . container . innerHTML = tplPlayer ( {
1322 options : this . options ,
1423 icons : Icons ,
24+ pic : pic ,
1525 } ) ;
1626
1727 this . lrc = this . container . querySelector ( '.aplayer-lrc-contents' ) ;
Original file line number Diff line number Diff line change 1- <div class="aplayer-pic">
1+ <div class="aplayer-pic"{{ if pic }} style="background-image: url("{{ pic }}");"{{ /if }} >
22 <div class="aplayer-button aplayer-play">{{@ icons.play }}</div>
33</div>
44<div class="aplayer-info">
You can’t perform that action at this time.
0 commit comments