mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
调整组件公共函数
This commit is contained in:
1 parent
8619fa1b8b
commit
c882814fb0
8 files changed
+167
-23
No files matched your search
@@ -40,11 +40,32 @@ export default class Layers {
|
||||
if (callback) {
|
||||
callback($layer);
|
||||
}
|
||||
this[name] = $layer;
|
||||
this.art.emit('layers:add', $layer);
|
||||
this.commonMethod(layer, $layer);
|
||||
this[name] = layer;
|
||||
this.art.emit('layers:add', layer);
|
||||
}
|
||||
}
|
||||
|
||||
commonMethod(layer, $layer) {
|
||||
Object.defineProperty(layer, '$ref', {
|
||||
get: () => $layer,
|
||||
});
|
||||
|
||||
Object.defineProperty(layer, 'hide', {
|
||||
value: () => {
|
||||
setStyle($layer, 'display', 'none');
|
||||
this.art.emit('layer:hide', $layer);
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(layer, 'show', {
|
||||
value: () => {
|
||||
setStyle($layer, 'display', 'block');
|
||||
this.art.emit('layer:show', $layer);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
show() {
|
||||
const { $layers } = this.art.refs;
|
||||
setStyle($layers, 'display', 'block');
|
||||
|
||||
Reference in new issue
Block a user