mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 23:51:20 -08:00
分离template
This commit is contained in:
1 parent
e96146b19f
commit
3fb41eedf7
39 files changed
+277
-256
No files matched your search
@@ -109,18 +109,7 @@ class Artplayer extends Emitter {
|
||||
init() {
|
||||
this.isFocus = false;
|
||||
this.isPlaying = false;
|
||||
this.refs = {};
|
||||
|
||||
if (this.option.container instanceof Element) {
|
||||
this.refs.$container = this.option.container;
|
||||
} else {
|
||||
this.refs.$container = document.querySelector(this.option.container);
|
||||
}
|
||||
|
||||
if (Artplayer.instances.some(art => art.refs.$container === this.refs.$container)) {
|
||||
utils.errorHandle(false, 'Cannot mount multiple instances on the same dom element');
|
||||
}
|
||||
|
||||
|
||||
this.whitelist = new Whitelist(this);
|
||||
this.template = new Template(this);
|
||||
this.storage = new Storage(this);
|
||||
@@ -146,13 +135,9 @@ class Artplayer extends Emitter {
|
||||
}
|
||||
|
||||
destroy(removeHtml = false) {
|
||||
this.events.destroy();
|
||||
Artplayer.instances.splice(Artplayer.instances.indexOf(this), 1);
|
||||
if (removeHtml) {
|
||||
this.refs.$container.innerHTML = '';
|
||||
} else {
|
||||
this.refs.$player.classList.add('artplayer-destroy');
|
||||
}
|
||||
this.events.destroy();
|
||||
this.template.destroy(removeHtml);
|
||||
this.emit('destroy');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user