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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
| <template>
| <div>
| <a-form-model ref="myForm" :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :rules="rules">
|
| <a-form-model-item label="名称" prop="name">
| <a-input v-model="form.name" placeholder="链接名称">
| </a-input>
| </a-form-model-item>
|
| <a-form-model-item label="链接地址" prop="url">
| <a-input v-model="form.url" placeholder="https:// or http://" />
| </a-form-model-item>
|
| <a-form-model-item label="分类" prop="linkType">
| <a-select v-model="form.linkType" mode="default" placeholder="链接类型"
| :getPopupContainer="getCalendarContainer()">
| <a-select-option v-for="(item,index) in this.linkTypeList" :key="index" :value="item.linkTypeId">
| {{ item.groupName }}
| </a-select-option>
| </a-select>
| </a-form-model-item>
|
|
| <a-form-model-item label="avatar" prop="avatar">
| <a-input v-model="form.avatar" placeholder="链接图片地址" />
| </a-form-model-item>
|
| <a-form-model-item label="remark" prop="remark">
| <a-input v-model="form.remark" placeholder="备注" />
| </a-form-model-item>
|
| <a-form-model-item label="权重">
| <a-slider v-model="form.topValue" :default-value="50" :step="5"
| :getTooltipPopupContainer="getCalendarContainer()" />
| <span class="myTip">
| 越小越靠前
| </span>
| </a-form-model-item>
|
| </a-form-model>
| </div>
| </template>
|
| <script>
| import {
| getLinkType
| } from '../../api/blogLink.js'
|
| export default {
| data() {
| return {
| form: {
| name: '',
| url: '',
| avatar: '',
| remark: '',
| linkType: undefined,
| topValue: 50,
| isNewWindowOpen: 1
| },
| linkTypeList: [],
| labelCol: {
| span: 7
| },
| wrapperCol: {
| span: 13
| },
| rules: {
| name: [{
| required: true,
| message: '名称不能为空',
| trigger: 'blur'
| },
| {
| min: 1,
| max: 50,
| message: '字数限制1~50',
| trigger: 'blur'
| },
| ],
| url: [{
| required: true,
| message: 'URL不能为空',
| trigger: 'blur'
| },
| {
| min: 1,
| max: 200,
| message: '字数限制1~200',
| trigger: 'blur'
| },
| {
| trigger: 'blur',
| pattern: /^((https|http)?:\/\/)+/,
| message: '仅支持 https:// | http://'
| }
| ],
| linkType: [{
| required: true,
| message: '至少选一个分类',
| trigger: 'blur'
| }],
| avatar: [{
| required: false,
| }, {
| trigger: 'blur',
| pattern: /^((https|http)?:\/\/)+/,
| message: '仅支持 https:// | http://'
| }],
|
| }
| }
| },
| methods: {
| getCalendarContainer(trigger) {
| return trigger => trigger.parentNode;
| },
| },
| beforeMount() {
| getLinkType({}).then((res) => {
| this.linkTypeList = res.data;
| })
| },
| }
| </script>
|
| <style>
| </style>
|
|