Refactor Setting class to fix state loss issue, update range callback return type, and remove isStringOrNumber utility function

This commit is contained in:
Harvey Zack committed 2024-10-20 13:56:22 +08:00
1 parent 191c7736c4
commit b949fedc06
9 files changed
+22 -40

No files matched your search

+1 -5
View File
@@ -10,7 +10,6 @@ import {
inverseClass,
createElement,
} from './dom';
import { isStringOrNumber } from './format';
import { errorHandle } from './error';
import validator from 'option-validator';
import { ComponentOption } from '../scheme';
@@ -143,10 +142,7 @@ export default class Component {
const find = option.selector[index] || {};
$value.innerText = $item.innerText;
if (option.onSelect) {
const result = await option.onSelect.call(this.art, find, $item, event);
if (isStringOrNumber(result)) {
$value.innerHTML = result;
}
$value.innerHTML = await option.onSelect.call(this.art, find, $item, event);
}
setLeft();
});