mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-23 13:51:20 -08:00
onSelect can return a promise
This commit is contained in:
1 parent
ec6b439d39
commit
f4ade95551
6 files changed
+904
-42
No files matched your search
@@ -123,7 +123,7 @@ export default class Component {
|
||||
|
||||
hover($ref, setLeft);
|
||||
|
||||
proxy($list, 'click', (event) => {
|
||||
proxy($list, 'click', async (event) => {
|
||||
const path = event.composedPath() || [];
|
||||
const $item = path.find((item) => hasClass(item, 'art-selector-item'));
|
||||
if (!$item) return;
|
||||
@@ -132,7 +132,7 @@ export default class Component {
|
||||
const find = option.selector[index] || {};
|
||||
$value.innerText = $item.innerText;
|
||||
if (option.onSelect) {
|
||||
const result = option.onSelect.call(this.art, find, $item, event);
|
||||
const result = await option.onSelect.call(this.art, find, $item, event);
|
||||
if (typeof result === 'string' || typeof result === 'number') {
|
||||
$value.innerHTML = result;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user