mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 05:41:20 -08:00
调整组件嵌入规则
This commit is contained in:
1 parent
88533c1023
commit
8619fa1b8b
22 files changed
+553
-392
No files matched your search
@@ -14,16 +14,18 @@ export default class Layers {
|
||||
add(item, callback) {
|
||||
const layer = typeof item === 'function' ? item(this.art) : item;
|
||||
if (!layer.disable) {
|
||||
id += 1;
|
||||
const {
|
||||
refs: { $layers },
|
||||
events: { proxy },
|
||||
} = this.art;
|
||||
id += 1;
|
||||
const name = layer.name || `layer${id}`;
|
||||
const $layer = document.createElement('div');
|
||||
$layer.classList.value = `art-layer art-layer-${name}`;
|
||||
setStyles($layer, layer.style || {});
|
||||
append($layer, layer.html);
|
||||
if (layer.html) {
|
||||
append($layer, layer.html);
|
||||
}
|
||||
if (layer.click) {
|
||||
proxy($layer, 'click', event => {
|
||||
event.preventDefault();
|
||||
@@ -32,13 +34,13 @@ export default class Layers {
|
||||
});
|
||||
}
|
||||
insertByIndex($layers, $layer, layer.index || id);
|
||||
this[name] = $layer;
|
||||
if (item.callback) {
|
||||
item.callback($layer);
|
||||
if (item.mounted) {
|
||||
item.mounted($layer);
|
||||
}
|
||||
if (callback) {
|
||||
callback($layer);
|
||||
}
|
||||
this[name] = $layer;
|
||||
this.art.emit('layers:add', $layer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user