optimize first poster display
This commit is contained in:
parent
5e610b15e8
commit
591b6b5cff
|
|
@ -62,6 +62,7 @@ class APlayer {
|
|||
this.template = new Template({
|
||||
container: this.container,
|
||||
options: this.options,
|
||||
randomOrder: this.randomOrder,
|
||||
});
|
||||
|
||||
if (this.template.info.offsetWidth < 200) {
|
||||
|
|
|
|||
|
|
@ -5,13 +5,23 @@ class Template {
|
|||
constructor (options) {
|
||||
this.container = options.container;
|
||||
this.options = options.options;
|
||||
this.randomOrder = this.randomOrder;
|
||||
this.init();
|
||||
}
|
||||
|
||||
init () {
|
||||
let pic;
|
||||
if (this.options.order === 'random') {
|
||||
pic = this.options.music[this.randomOrder[0]].pic;
|
||||
}
|
||||
else {
|
||||
pic = this.options.music[0].pic;
|
||||
}
|
||||
|
||||
this.container.innerHTML = tplPlayer({
|
||||
options: this.options,
|
||||
icons: Icons,
|
||||
pic: pic,
|
||||
});
|
||||
|
||||
this.lrc = this.container.querySelector('.aplayer-lrc-contents');
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="aplayer-pic">
|
||||
<div class="aplayer-pic"{{ if pic }} style="background-image: url("{{ pic }}");"{{ /if }}>
|
||||
<div class="aplayer-button aplayer-play">{{@ icons.play }}</div>
|
||||
</div>
|
||||
<div class="aplayer-info">
|
||||
|
|
|
|||
Loading…
Reference in New Issue