compatibility with old version
This commit is contained in:
+11
-2
@@ -3,16 +3,18 @@ export default (options) => {
|
||||
// default options
|
||||
const defaultOption = {
|
||||
container: options.element || document.getElementsByClassName('aplayer')[0],
|
||||
mini: false,
|
||||
mini: options.narrow || false,
|
||||
autoplay: false,
|
||||
mutex: true,
|
||||
lrc: 0,
|
||||
lrc: options.showlrc || 0,
|
||||
preload: 'auto',
|
||||
theme: '#b7daff',
|
||||
loop: 'all',
|
||||
order: 'list',
|
||||
volume: 0.7,
|
||||
listFolded: false,
|
||||
listMaxHeight: options.listmaxheight,
|
||||
audio: options.music
|
||||
};
|
||||
for (const defaultKey in defaultOption) {
|
||||
if (defaultOption.hasOwnProperty(defaultKey) && !options.hasOwnProperty(defaultKey)) {
|
||||
@@ -24,6 +26,13 @@ export default (options) => {
|
||||
options.audio = [options.audio];
|
||||
}
|
||||
|
||||
options.audio.map((item) => {
|
||||
item.name = item.name || item.title;
|
||||
item.artist = item.artist || item.author;
|
||||
item.cover = item.cover || item.pic;
|
||||
return item;
|
||||
});
|
||||
|
||||
if (options.audio.length <= 1 && options.loop === 'one') {
|
||||
options.loop = 'all';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user