mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-12 15:26:16 -08:00
update
This commit is contained in:
1 parent
d276c22f9c
commit
5f6febce42
6 files changed
+65
-22
No files matched your search
+17
-10
@@ -20,17 +20,24 @@ export default class Layers {
|
||||
const { refs } = this.art;
|
||||
id++;
|
||||
|
||||
refs.$layers.insertAdjacentHTML('beforeend', `
|
||||
<div
|
||||
data-art-layer-id="${id}"
|
||||
class="art-layer art-layer-${option.name || id}"
|
||||
style="z-index: ${option.index || id}"
|
||||
>
|
||||
${option.html || ''}
|
||||
</div>
|
||||
`);
|
||||
const $layer = document.createElement('div');
|
||||
$layer.setAttribute('data-art-layer-id', id);
|
||||
$layer.setAttribute('class', `art-layer art-layer-${option.name || id}`);
|
||||
$layer.style.zIndex = option.index || id;
|
||||
|
||||
const $layer = refs.$layers.querySelector(`[data-art-layer-id="${id}"]`);
|
||||
if (option.html instanceof Element) {
|
||||
$layer.appendChild(option.html);
|
||||
} else {
|
||||
$layer.innerHTML = option.html;
|
||||
}
|
||||
|
||||
if (option.style) {
|
||||
Object.keys(option.style).forEach(key => {
|
||||
$layer.style[key] = option.style[key];
|
||||
});
|
||||
}
|
||||
|
||||
refs.$layers.appendChild($layer);
|
||||
callback && callback($layer);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user