mirror of
https://github.com/HugoAura/Seewo-HugoAura.git
synced 2026-06-22 08:14:26 +08:00
1. [/] 为 Revive 元素添加了自定义事件触发, 从而正确处理 Remount 发生时的情况 2. [/] 为 Input 元素添加了正确的 onSubmit 事件处理
This commit is contained in:
@@ -145,9 +145,10 @@ const renderInputArea = (entry, operationArea, descriptionArea) => {
|
||||
inputEl.value = entry.valueGetter();
|
||||
inputEl.placeholder = entry.placeHolder;
|
||||
inputEl.id = entry.id;
|
||||
inputEl.addEventListener("change", async (event) => {
|
||||
|
||||
const handleSubmit = async (event = null) => {
|
||||
const result = await entry.callbackFn(
|
||||
event.target.value,
|
||||
event ? event.target.value : inputEl.value,
|
||||
inputEl,
|
||||
operationArea,
|
||||
descriptionArea
|
||||
@@ -166,7 +167,17 @@ const renderInputArea = (entry, operationArea, descriptionArea) => {
|
||||
descriptionArea.textContent = result.hint;
|
||||
descriptionArea.classList.add("ase-desc-error-hint");
|
||||
}
|
||||
};
|
||||
|
||||
inputEl.addEventListener("change", async (event) => {
|
||||
await handleSubmit(event);
|
||||
});
|
||||
|
||||
inputEl.onsubmit = async (evt) => {
|
||||
evt.preventDefault();
|
||||
await handleSubmit();
|
||||
};
|
||||
|
||||
operationArea.classList.add("ase-operation-area-expanded");
|
||||
return inputEl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user