mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 10:01:20 -08:00
简化事件
This commit is contained in:
1 parent
938b90f3a7
commit
4718cd186b
36 files changed
+223
-250
No files matched your search
@@ -21,7 +21,7 @@ export default class Component {
|
||||
} else {
|
||||
removeClass($player, className);
|
||||
}
|
||||
this.art.emit(`${this.name}Toggle`, value);
|
||||
this.art.emit(this.name, value);
|
||||
}
|
||||
|
||||
set toggle(value) {
|
||||
@@ -53,7 +53,7 @@ export default class Component {
|
||||
|
||||
const childs = Array.from(this.$parent.children);
|
||||
$ref.dataset.index = option.index || this.id;
|
||||
const nextChild = childs.find(item => Number(item.dataset.index) >= Number($ref.dataset.index));
|
||||
const nextChild = childs.find((item) => Number(item.dataset.index) >= Number($ref.dataset.index));
|
||||
if (nextChild) {
|
||||
nextChild.insertAdjacentElement('beforebegin', $ref);
|
||||
} else {
|
||||
@@ -61,7 +61,7 @@ export default class Component {
|
||||
}
|
||||
|
||||
if (option.click) {
|
||||
this.art.events.proxy($ref, 'click', event => {
|
||||
this.art.events.proxy($ref, 'click', (event) => {
|
||||
event.preventDefault();
|
||||
option.click.call(this.art, this, event);
|
||||
});
|
||||
@@ -75,8 +75,6 @@ export default class Component {
|
||||
callback($ref, this, this.art);
|
||||
}
|
||||
|
||||
this.art.emit(`${this.name}Add`, option);
|
||||
|
||||
def(this, name, {
|
||||
get: () => option,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user