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