mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-19 11:21:20 -08:00
update component.d.ts
This commit is contained in:
1 parent
cd28cc795f
commit
645e2e2ec3
5 files changed
+53
-41
No files matched your search
@@ -48,11 +48,10 @@ export default class Component {
|
||||
const option = typeof getOption === 'function' ? getOption(this.art) : getOption;
|
||||
option.html = option.html || '';
|
||||
validator(option, ComponentOption);
|
||||
|
||||
if (!this.$parent || !this.name || option.disable) return;
|
||||
const name = option.name || `${this.name}${this.id}`;
|
||||
const item = this.cache.get(name);
|
||||
errorHandle(!item, `Can't add an existing name [${name}] to the [${this.name}]`);
|
||||
errorHandle(!item, `Can't add an existing [${name}] to the [${this.name}]`);
|
||||
|
||||
this.id += 1;
|
||||
const $ref = createElement('div');
|
||||
@@ -157,7 +156,7 @@ export default class Component {
|
||||
|
||||
remove(name) {
|
||||
const item = this.cache.get(name);
|
||||
errorHandle(item, `Can't find name [${name}] to the [${this.name}]`);
|
||||
errorHandle(item, `Can't find [${name}] from the [${this.name}]`);
|
||||
|
||||
for (let index = 0; index < item.events.length; index++) {
|
||||
const destroyEvent = item.events[index];
|
||||
@@ -169,9 +168,9 @@ export default class Component {
|
||||
delete this[name];
|
||||
}
|
||||
|
||||
update(option = {}) {
|
||||
update(option) {
|
||||
const item = this.cache.get(option.name);
|
||||
if (item) this.remove(option.name);
|
||||
this.add(option);
|
||||
return this.add(option);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user