1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
| <template>
| <div class="myModal">
| <a-modal v-model="visible" title="添加链接.." :bodyStyle="{'overflow':'overlay','maxHeight': '550px'}"
| on-ok="handleOk">
| <template slot="footer">
| <a-button key="submit" type="primary" :loading="loading" @click="handleOk">
| ok
| </a-button>
| </template>
| <LinkAdd ref="linkAddBox"></LinkAdd>
| </a-modal>
| </div>
|
| </template>
|
| <script>
| import LinkAdd from "../mini/box17-linkAdd.vue"
| import {
| addLink
| } from '../../api/blogLink.js'
|
| export default {
| components: {
| LinkAdd
| },
| data() {
| return {
| visible: false,
| loading: false,
| }
| },
| methods: {
| showModal() {
| this.visible = true;
| },
| handleCancel(e) {
| this.visible = false;
| },
| handleOk(e) {
| console.log(this.$refs.linkAddBox.form);
| var res;
| this.$refs.linkAddBox.$refs.myForm.validate(valid => {
| if (valid) {
| this.$message.info("校验通过")
| res = true;
| } else {
| this.$message.info("校验失败")
| res = false;
| }
| });
|
| if (!res) return;
| this.$message.info("提交表单")
|
| let tempData = this.$refs.linkAddBox.form;
|
|
|
| console.log(tempData)
| this.loading = true;
| addLink(tempData).then((res) => {
| this.$message.info("添加成功..")
| this.visible = false;
| this.loading = false;
| });
| }
|
| },
| }
| </script>
| <style scoped>
|
| </style>
|
|