From 1ad93b699ff890327de9a65f26611e9415140600 Mon Sep 17 00:00:00 2001 From: inleft <inleft@qq.com> Date: Tue, 18 Jan 2022 01:31:56 +0800 Subject: [PATCH] 表单校验 --- src/components/swichLabel/main1-show.vue | 55 +++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/components/swichLabel/main1-show.vue b/src/components/swichLabel/main1-show.vue index 15a592b..1da01f3 100644 --- a/src/components/swichLabel/main1-show.vue +++ b/src/components/swichLabel/main1-show.vue @@ -12,19 +12,23 @@ :bodyStyle="{padding:'0px'}" :wrapStyle="{padding:'0px',top:'60px'}"> <boxRight></boxRight> </a-drawer> - - <a-modal v-model="visible" title="日志添加" on-ok="handleOk" > - <template slot="footer"> - <a-button key="back" @click="handleCancel"> - 暂缓 - </a-button> - <a-button key="submit" type="primary" :loading="loading" @click="handleOk"> - 完事.. - </a-button> - </template> - <box10 ref="modal" ></box10> - </a-modal> - + <a-row> + <a-col v-bind="colApiLeft"> + <div class="myModal"> + <a-modal v-model="visible" title="日志添加" on-ok="handleOk"> + <template slot="footer"> + <a-button key="back" @click="handleCancel"> + 歇会 + </a-button> + <a-button key="submit" type="primary" :loading="loading" @click="handleOk"> + 完事<span style="font-size: 10px;">儿</span>.. + </a-button> + </template> + <box10 ref="modalBox"></box10> + </a-modal> + </div> + </a-col> + </a-row> </div> <div class="blog-main"> <a-row> @@ -41,8 +45,9 @@ </a-button> <a-button @click="showModal"> 日志 - <a-icon type="plus-circle" style="margin-left: 0px;"/> + <a-icon type="plus-circle" style="margin-left: 0px;" /> </a-button> + <!-- <tempFormCheck></tempFormCheck> --> <router-view class="fade"></router-view> </a-col> @@ -56,6 +61,7 @@ </template> <script> + import tempFormCheck from "../group/tempFormCheck.vue" import box10 from "../mini/box10-add.vue" import boxLeft from "../group/boxLeft.vue" import boxRight from "../group/boxRight.vue" @@ -65,6 +71,7 @@ export default { components: { + tempFormCheck, box10, boxLeft, boxRight, @@ -74,12 +81,28 @@ }, methods: { + getCalendarContainer(trigger) { + return this.$refs.myModal; + }, showModal() { this.visible = true; }, handleOk(e) { - console.log(this.$refs.modal.form); - + console.log(this.$refs.modalBox.form); + var res=this.$refs.modalBox.$refs.myForm.validate(valid => { + if (valid) { + this.$message.info("校验通过") + } else { + this.$message.info("校验失败") + return false; + } + }); + + + if(!res)return; + + this.$message.info("提交表单") + this.loading = true; setTimeout(() => { this.visible = false; -- Gitblit v1.9.1