简化事件

This commit is contained in:
Harvey committed 2020-05-22 13:23:28 +08:00
1 parent 938b90f3a7
commit 4718cd186b
36 files changed
+223 -250

No files matched your search

+3 -5
View File
@@ -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,
});