|
1 | 1 | <template> |
2 | 2 | <el-form-item label="文本长度" required> |
3 | | - <el-col :span="11" style="padding-left: 0"> |
4 | | - <el-form-item |
5 | | - :rules="[ |
6 | | - { |
7 | | - required: true, |
8 | | - message: '最小长度必填', |
9 | | - trigger: 'change' |
10 | | - } |
11 | | - ]" |
12 | | - prop="minlength" |
13 | | - > |
14 | | - <el-input-number |
15 | | - style="width: 100%" |
16 | | - :min="1" |
17 | | - :step="1" |
18 | | - step-strictly |
19 | | - v-model="formValue.minlength" |
20 | | - controls-position="right" |
21 | | - /> |
22 | | - </el-form-item> |
23 | | - </el-col> |
24 | | - <el-col :span="2" class="text-center"> |
25 | | - <span class="text-gray-500">-</span> |
26 | | - </el-col> |
27 | | - <el-col :span="11"> |
28 | | - <el-form-item |
29 | | - :rules="[ |
30 | | - { |
31 | | - required: true, |
32 | | - message: '最大长度必填', |
33 | | - trigger: 'change' |
34 | | - } |
35 | | - ]" |
36 | | - prop="maxlength" |
37 | | - > |
38 | | - <el-input-number |
39 | | - style="width: 100%" |
40 | | - :min="formValue.minlength > formValue.maxlength ? formValue.minlength : 1" |
41 | | - step-strictly |
42 | | - :step="1" |
43 | | - v-model="formValue.maxlength" |
44 | | - controls-position="right" |
45 | | - /></el-form-item> |
46 | | - </el-col> |
| 3 | + <el-row class="w-full"> |
| 4 | + <el-col :span="11"> |
| 5 | + <el-form-item |
| 6 | + :rules="[ |
| 7 | + { |
| 8 | + required: true, |
| 9 | + message: '最小长度必填', |
| 10 | + trigger: 'change' |
| 11 | + } |
| 12 | + ]" |
| 13 | + prop="minlength" |
| 14 | + > |
| 15 | + <el-input-number |
| 16 | + style="width: 100%" |
| 17 | + :min="1" |
| 18 | + :step="1" |
| 19 | + step-strictly |
| 20 | + v-model="formValue.minlength" |
| 21 | + controls-position="right" |
| 22 | + /> |
| 23 | + </el-form-item> |
| 24 | + </el-col> |
| 25 | + <el-col :span="2" class="text-center"> |
| 26 | + <span>-</span> |
| 27 | + </el-col> |
| 28 | + <el-col :span="11"> |
| 29 | + <el-form-item |
| 30 | + :rules="[ |
| 31 | + { |
| 32 | + required: true, |
| 33 | + message: '最大长度必填', |
| 34 | + trigger: 'change' |
| 35 | + } |
| 36 | + ]" |
| 37 | + prop="maxlength" |
| 38 | + > |
| 39 | + <el-input-number |
| 40 | + style="width: 100%" |
| 41 | + :min="formValue.minlength > formValue.maxlength ? formValue.minlength : 1" |
| 42 | + step-strictly |
| 43 | + :step="1" |
| 44 | + v-model="formValue.maxlength" |
| 45 | + controls-position="right" |
| 46 | + /></el-form-item> |
| 47 | + </el-col> |
| 48 | + </el-row> |
47 | 49 | </el-form-item> |
48 | 50 |
|
49 | 51 | <el-form-item |
| 52 | + class="defaultValueItem" |
50 | 53 | :required="formValue.required" |
51 | 54 | prop="default_value" |
| 55 | + label="默认值" |
52 | 56 | :rules=" |
53 | 57 | formValue.required ? [{ required: true, message: '默认值 为必填属性' }, ...rules] : rules |
54 | 58 | " |
55 | 59 | > |
56 | | - <template #label> |
57 | | - <div class="flex-between"> |
58 | | - 默认值 |
59 | | - <el-checkbox v-model="formValue.show_default_value" label="显示默认值" /> |
60 | | - </div> |
61 | | - </template> |
| 60 | + <div class="defaultValueCheckbox"> |
| 61 | + <el-checkbox v-model="formValue.show_default_value" label="显示默认值" /> |
| 62 | + </div> |
| 63 | + |
62 | 64 | <el-input |
63 | 65 | v-model="formValue.default_value" |
64 | 66 | :maxlength="formValue.maxlength" |
@@ -166,4 +168,13 @@ onMounted(() => { |
166 | 168 | } |
167 | 169 | }) |
168 | 170 | </script> |
169 | | -<style lang="scss"></style> |
| 171 | +<style lang="scss" scoped> |
| 172 | +.defaultValueItem { |
| 173 | + position: relative; |
| 174 | + .defaultValueCheckbox { |
| 175 | + position: absolute; |
| 176 | + right: 0; |
| 177 | + top: -35px; |
| 178 | + } |
| 179 | +} |
| 180 | +</style> |
0 commit comments