mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-18 19:01:20 -08:00
add meun
This commit is contained in:
1 parent
4327787895
commit
e420005bcd
11 files changed
+233
-74
No files matched your search
+12
-2
@@ -2,15 +2,25 @@ let id = 0;
|
||||
export default class Layers {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
this.add = this.add.bind(this);
|
||||
this.art.option.layers.forEach(this.add);
|
||||
}
|
||||
|
||||
add(option) {
|
||||
const { refs } = this.art;
|
||||
id++;
|
||||
|
||||
refs.$layers.insertAdjacentHTML('beforeend', `
|
||||
<div data-layer-index="${id}" class="art-layer art-layer-${option.name}" style="z-index: ${option.index || id}">
|
||||
${option.html}
|
||||
<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 = refs.$layers.querySelector(`[data-art-layer-id="${id}"]`);
|
||||
option.callback && option.callback($layer);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user