优化回调参数

This commit is contained in:
Harvey Zack committed 2019-04-22 13:32:27 +08:00
1 parent 2385128abb
commit 62c05ef659
5 files changed
+44 -31

No files matched your search

+13 -6
View File
@@ -399,10 +399,10 @@
if (child instanceof Element) {
parent.appendChild(child);
} else {
parent.insertAdjacentHTML('beforeend', child);
parent.insertAdjacentHTML('beforeend', String(child));
}
return parent.lastElementChild;
return parent.lastElementChild || parent.lastChild;
}
function remove(child) {
return child.parentNode.removeChild(child);
@@ -3279,7 +3279,7 @@
if (option.click) {
art.events.proxy($element, 'click', function (event) {
event.preventDefault();
option.click.call(parent, event);
option.click.call(parent, event, art);
art.emit("".concat(title, ":click"), $element);
});
}
@@ -3297,18 +3297,25 @@
});
Object.defineProperty(option, 'show', {
value: function value() {
setStyle($element, 'display', 'block');
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'block';
setStyle($element, 'display', type);
art.emit("".concat(title, ":show"), $element);
}
});
Object.defineProperty(option, 'remove', {
value: function value() {
remove($element);
art.emit("".concat(title, ":remove"), $element);
}
});
insertByIndex(target, $element, option.index || parent.id);
if (option.mounted) {
option.mounted($element);
option.mounted($element, parent, art);
}
if (callback) {
callback($element);
callback($element, parent, art);
}
parent[name] = option;