mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 05:41:20 -08:00
Refactor Artplayer class to update import path for Component
This commit is contained in:
1 parent
2db49bdede
commit
ed88c73ab2
4 files changed
+26
-15
No files matched your search
@@ -172,33 +172,35 @@ export default class Setting extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
inactivate(item) {
|
||||
for (let index = 0; index < item.$events.length; index++) {
|
||||
this.art.events.remove(item.$events[index]);
|
||||
}
|
||||
item.$events.length = 0;
|
||||
}
|
||||
|
||||
remove(name) {
|
||||
const item = this.find(name);
|
||||
errorHandle(item, `Can't find [${name}] in the [setting]`);
|
||||
const index = item.$option.indexOf(item);
|
||||
item.$option.splice(index, 1);
|
||||
|
||||
for (let index = 0; index < item.$events.length; index++) {
|
||||
this.art.events.remove(item.$events[index]);
|
||||
}
|
||||
|
||||
if (item.$item) {
|
||||
remove(item.$item);
|
||||
}
|
||||
|
||||
item.$events.length = 0;
|
||||
this.inactivate(item);
|
||||
if (item.$item) remove(item.$item);
|
||||
this.render();
|
||||
}
|
||||
|
||||
update(target) {
|
||||
const item = this.find(target.name);
|
||||
|
||||
if (item) {
|
||||
this.inactivate(item);
|
||||
Object.assign(item, target);
|
||||
this.format();
|
||||
this.creatItem(item, true);
|
||||
this.render();
|
||||
return item;
|
||||
} else {
|
||||
this.add(target);
|
||||
return this.add(target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +209,7 @@ export default class Setting extends Component {
|
||||
this.format();
|
||||
this.creatItem(item);
|
||||
this.render();
|
||||
return item;
|
||||
}
|
||||
|
||||
creatHeader(item) {
|
||||
|
||||
Reference in new issue
Block a user