mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 13:51:20 -08:00
优化回调
This commit is contained in:
1 parent
8148973d39
commit
a0bc4d3a39
3 files changed
+13
-10
No files matched your search
@@ -112,15 +112,16 @@ export default class Controls {
|
||||
});
|
||||
}
|
||||
|
||||
add(control) {
|
||||
add(control, callback) {
|
||||
const { option } = control;
|
||||
if (option && !option.disable) {
|
||||
id++;
|
||||
const name = option.name || control.constructor.name.toLowerCase() || `control${id}`;
|
||||
const name = option.name || `control${id}`;
|
||||
const $control = document.createElement('div');
|
||||
$control.setAttribute('class', `art-control art-control-${name}`);
|
||||
this.mount(option.position, $control, option.index || id);
|
||||
control.apply && control.apply(this.art, $control);
|
||||
callback && callback($control);
|
||||
this[name] = control;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user