onSelect can return a promise

This commit is contained in:
Harvey committed 2022-04-27 15:44:06 +08:00
1 parent ec6b439d39
commit f4ade95551
6 files changed
+904 -42

No files matched your search

+2 -2
View File
@@ -197,7 +197,7 @@ export default class Setting extends Component {
append($right, $arrow);
}
const event = proxy($item, 'click', (event) => {
const event = proxy($item, 'click', async (event) => {
if (hasChildren) {
this.init(item.selector, item.width);
} else {
@@ -208,7 +208,7 @@ export default class Setting extends Component {
}
if (item._parentItem && item._parentItem.onSelect) {
const result = item._parentItem.onSelect.call(this.art, item, $item, event);
const result = await item._parentItem.onSelect.call(this.art, item, $item, event);
if (item._parentItem._$tooltip) {
if (typeof result === 'string' || typeof result === 'number') {
item._parentItem._$tooltip.innerHTML = result;