inleft
2022-02-21 63f5119bcc714c36fe8db21e5461d73eb5a0eaa0
commit | author | age
b505f3 1 <template>
I 2     <div class="myModal">
3         <a-modal v-model="visible" title="日志添加" on-ok="handleOk"
4             :bodyStyle="{'overflow':'overlay','maxHeight': '550px'}">
5             <template slot="footer">
6                 <a-button key="reset" @click="reset" type="danger">
7                     擦掉重来
8                 </a-button>
9                 <a-button key="back" @click="handleCancel">
10                     歇会
11                 </a-button>
12                 <a-button key="submit" type="primary" :loading="loading" @click="handleOk">
13                     完事<span style="font-size: 10px;">儿</span>..
14                 </a-button>
15             </template>
16             <box10 ref="modalBox"></box10>
17         </a-modal>
18     </div>
19
20 </template>
21
22 <script>
23     import box10 from "../mini/box10-add.vue"
63f511 24     
I 25     import {
26         blogAdd
27     } from '../../api/blogArticle.js'
28     
b505f3 29     export default {
I 30         components: {
31             box10
32         },
33         data() {
34             return {
35                 visible: false,
36                 loading: false,
37             }
38         },
39         methods: {
40             getCalendarContainer(trigger) {
41                 return this.$refs.myModal;
42             },
43             showModal() {
44                 this.visible = true;
45             },
46             handleOk(e) {
47                 console.log(this.$refs.modalBox.form);
48                 var res = this.$refs.modalBox.$refs.myForm.validate(valid => {
49                     if (valid) {
50                         this.$message.info("校验通过")
51                     } else {
52                         this.$message.info("校验失败")
53                         return false;
54                     }
55                 });
56
57
58                 if (!res) return;
59
60                 this.$message.info("提交表单")
61
62                 this.loading = true;
63                 setTimeout(() => {
64                     this.visible = false;
65                     this.loading = false;
66                 }, 3000);
67             },
68             reset(e) {
69                 var res = this.$refs.modalBox.$refs.myForm.resetFields()
70             },
71             handleCancel(e) {
72                 this.visible = false;
73             },
74
75         },
76     }
77 </script>
78
79 <style>
80 </style>