🐛(component): 修复表单的"空指针"问题

This commit is contained in:
就眠儀式
2022-09-09 00:35:58 +08:00
parent 92021b09e9
commit beff81863f
2 changed files with 5 additions and 2 deletions

View File

@@ -145,8 +145,8 @@ const clearValidate = () => {
errorStatus.value = false;
errorMsg.value = "";
const slotParentDiv = slotParent.value as HTMLDivElement;
slotParentDiv.childElementCount > 0 &&
slotParentDiv.firstElementChild?.classList.remove("layui-form-danger");
slotParentDiv?.childElementCount > 0 &&
slotParentDiv?.firstElementChild?.classList.remove("layui-form-danger");
};
defineExpose({ validate, clearValidate });