🐛(component): 修复表单的"空指针"问题
This commit is contained in:
parent
92021b09e9
commit
beff81863f
@ -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 });
|
||||
|
@ -29,6 +29,9 @@
|
||||
<lay-form-item label="描述" prop="desc">
|
||||
<lay-textarea placeholder="请输入描述" v-model="model.desc"></lay-textarea>
|
||||
</lay-form-item>
|
||||
<lay-form-item label="时间" prop="datetime" required>
|
||||
<lay-date-picker v-model="model.datetime" range type="datetime"></lay-date-picker>
|
||||
</lay-form-item>
|
||||
<lay-form-item>
|
||||
<lay-button @click="submitClick">提交</lay-button>
|
||||
</lay-form-item>
|
||||
|
Loading…
Reference in New Issue
Block a user