matrix_components 2.0.360 → 2.0.362
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/ComponentDemo/FormDemo.vue +306 -283
- package/dist/ComponentDemo/Test.vue +4 -4
- package/dist/matrix_components.css +1 -1
- package/dist/matrix_components.js +701 -471
- package/dist/matrix_components.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,306 +2,329 @@
|
|
|
2
2
|
<div class="demo-container">
|
|
3
3
|
<div class="control-panel">
|
|
4
4
|
<h3>动态表单组件演示</h3>
|
|
5
|
-
|
|
6
5
|
<!-- 配置文件选择 -->
|
|
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
|
-
:clear-validate-on-init="true"
|
|
59
|
-
@validate="handleValidate"
|
|
60
|
-
@submit="handleSubmit"
|
|
61
|
-
@reset="handleReset"
|
|
62
|
-
>
|
|
63
|
-
<!-- 自定义插槽示例 -->
|
|
64
|
-
<template #customSlot="{ item, formData }">
|
|
65
|
-
<el-input
|
|
66
|
-
v-model="formData[item.prop]"
|
|
67
|
-
placeholder="这是自定义插槽内容"
|
|
68
|
-
prefix-icon="User"
|
|
69
|
-
/>
|
|
70
|
-
</template>
|
|
71
|
-
|
|
72
|
-
<!-- 表单操作按钮 -->
|
|
73
|
-
<template #footer="{ validate, resetFields }">
|
|
74
|
-
<el-form-item>
|
|
75
|
-
<el-button type="primary" @click="validate">提交表单</el-button>
|
|
76
|
-
<el-button @click="resetFields">重置表单</el-button>
|
|
77
|
-
</el-form-item>
|
|
78
|
-
</template>
|
|
79
|
-
</NsForm>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<!-- 空状态 -->
|
|
83
|
-
<div class="empty-state" v-else>
|
|
84
|
-
<el-empty description="请选择或上传表单配置文件" />
|
|
6
|
+
<el-form :model="state" ref="formRef" label-position="left">
|
|
7
|
+
<el-button type="primary" @click="getFormData">获取表单数据</el-button>
|
|
8
|
+
<br>
|
|
9
|
+
<span style="color: red">
|
|
10
|
+
结果:{{ state.formData }}
|
|
11
|
+
</span>
|
|
12
|
+
<br>
|
|
13
|
+
<br>
|
|
14
|
+
<NsFormTitle title="模型参数">
|
|
15
|
+
<NsForm
|
|
16
|
+
ref="row1Ref"
|
|
17
|
+
:readOnly="state.readOnly"
|
|
18
|
+
backgroundColor="#fff"
|
|
19
|
+
:model="state.model"
|
|
20
|
+
:rows="state.rows"
|
|
21
|
+
formPropKey="rows"
|
|
22
|
+
labelColor="#606266"
|
|
23
|
+
labelWidth="150"
|
|
24
|
+
gapH="20px"
|
|
25
|
+
gapV="10px"
|
|
26
|
+
></NsForm>
|
|
27
|
+
</NsFormTitle>
|
|
28
|
+
<NsFormTitle title="视频配置">
|
|
29
|
+
<NsForm
|
|
30
|
+
ref="row2Ref"
|
|
31
|
+
:readOnly="state.readOnly"
|
|
32
|
+
backgroundColor="#fff"
|
|
33
|
+
:model="state.model"
|
|
34
|
+
:rows="state.rows2"
|
|
35
|
+
formPropKey="rows2"
|
|
36
|
+
labelColor="#606266"
|
|
37
|
+
labelWidth="150"
|
|
38
|
+
gapH="20px"
|
|
39
|
+
gapV="10px"
|
|
40
|
+
></NsForm>
|
|
41
|
+
</NsFormTitle>
|
|
42
|
+
<NsFormTitle title="结果保存">
|
|
43
|
+
<NsForm
|
|
44
|
+
ref="row3Ref"
|
|
45
|
+
:readOnly="state.readOnly"
|
|
46
|
+
backgroundColor="#fff"
|
|
47
|
+
:model="state.model"
|
|
48
|
+
:rows="state.rows3"
|
|
49
|
+
formPropKey="rows3"
|
|
50
|
+
labelColor="#606266"
|
|
51
|
+
labelWidth="150"
|
|
52
|
+
gapH="20px"
|
|
53
|
+
gapV="10px"
|
|
54
|
+
></NsForm>
|
|
55
|
+
</NsFormTitle>
|
|
56
|
+
</el-form>
|
|
85
57
|
</div>
|
|
86
|
-
|
|
87
|
-
<!-- 表单数据显示 -->
|
|
88
|
-
<el-card v-if="showFormData && formLoaded" class="data-card">
|
|
89
|
-
<template #header>
|
|
90
|
-
<div class="card-header">
|
|
91
|
-
<span>表单数据</span>
|
|
92
|
-
<el-button type="text" @click="copyFormData">复制数据</el-button>
|
|
93
|
-
</div>
|
|
94
|
-
</template>
|
|
95
|
-
<pre class="form-data-display">{{ JSON.stringify(formData, null, 2) }}</pre>
|
|
96
|
-
</el-card>
|
|
97
58
|
</div>
|
|
98
59
|
</template>
|
|
99
60
|
|
|
100
61
|
<script setup lang="ts">
|
|
101
|
-
import { ElMessage } from
|
|
102
|
-
import {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
62
|
+
import { ElInput, ElMessage, ElRadioGroup } from "element-plus";
|
|
63
|
+
import { reactive, ref } from 'vue';
|
|
64
|
+
|
|
65
|
+
const props = defineProps({
|
|
66
|
+
readOnly: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false,
|
|
69
|
+
},
|
|
70
|
+
row: {
|
|
71
|
+
type: Object,
|
|
72
|
+
default: () => ({}),
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const formRef = ref();
|
|
77
|
+
const row1Ref = ref();
|
|
78
|
+
const row2Ref = ref();
|
|
79
|
+
const row3Ref = ref();
|
|
80
|
+
const state = reactive({
|
|
81
|
+
formData: {},
|
|
82
|
+
readOnly: props.readOnly,
|
|
83
|
+
model: props.readOnly ? "" : "vertical",
|
|
84
|
+
// 第一种方式,在初始化前设置数据
|
|
85
|
+
rows: [
|
|
86
|
+
[
|
|
87
|
+
{
|
|
88
|
+
key: "confidence",
|
|
89
|
+
label: "置信度",
|
|
90
|
+
value: "",
|
|
91
|
+
component: ElInput,
|
|
92
|
+
params: {
|
|
93
|
+
"v-length.range": {
|
|
94
|
+
min: 0,
|
|
95
|
+
max: 1,
|
|
96
|
+
maxLength: 3 },
|
|
97
|
+
rules: [
|
|
98
|
+
{
|
|
99
|
+
required: true,
|
|
100
|
+
message: "请输入",
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: "iou",
|
|
107
|
+
label: "交并比",
|
|
108
|
+
value: "",
|
|
109
|
+
component: ElInput,
|
|
110
|
+
params: {
|
|
111
|
+
"v-length.range": {
|
|
112
|
+
min: 0,
|
|
113
|
+
max: 1,
|
|
114
|
+
maxLength: 3 },
|
|
115
|
+
rules: [
|
|
116
|
+
{
|
|
117
|
+
required: true,
|
|
118
|
+
message: "请输入",
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
],
|
|
125
|
+
rows2: [
|
|
126
|
+
[
|
|
127
|
+
{
|
|
128
|
+
key: "timeInterval",
|
|
129
|
+
label: "时间间隔(秒)",
|
|
130
|
+
value: "",
|
|
131
|
+
component: ElInput,
|
|
132
|
+
params: {
|
|
133
|
+
"v-length.range": {
|
|
134
|
+
min: 0,
|
|
135
|
+
max: 6000,
|
|
136
|
+
int: true
|
|
137
|
+
},
|
|
138
|
+
rules: [
|
|
139
|
+
{
|
|
140
|
+
required: true,
|
|
141
|
+
message: "请输入",
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
key: "stuck_threshold",
|
|
148
|
+
label: "视频帧卡顿(秒)",
|
|
149
|
+
value: "",
|
|
150
|
+
component: ElInput,
|
|
151
|
+
params: {
|
|
152
|
+
"v-length.range": {
|
|
153
|
+
min: 0,
|
|
154
|
+
max: 1000,
|
|
155
|
+
int: true
|
|
156
|
+
},
|
|
157
|
+
rules: [
|
|
158
|
+
{
|
|
159
|
+
required: true,
|
|
160
|
+
message: "请输入",
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
[
|
|
167
|
+
{
|
|
168
|
+
key: "max_retries",
|
|
169
|
+
label: "最大重连次数",
|
|
170
|
+
value: "",
|
|
171
|
+
component: ElInput,
|
|
172
|
+
params: {
|
|
173
|
+
"v-length.range": {
|
|
174
|
+
min: 0,
|
|
175
|
+
max: 100,
|
|
176
|
+
int: true
|
|
177
|
+
},
|
|
178
|
+
rules: [
|
|
179
|
+
{
|
|
180
|
+
required: true,
|
|
181
|
+
message: "请输入",
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
value: ' '
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
],
|
|
191
|
+
rows3: [
|
|
192
|
+
[
|
|
193
|
+
{
|
|
194
|
+
key: "save_video",
|
|
195
|
+
label: "是否保存视频",
|
|
196
|
+
value: '1',
|
|
197
|
+
component: ElRadioGroup,
|
|
198
|
+
params: {
|
|
199
|
+
rules: [
|
|
200
|
+
{
|
|
201
|
+
required: true,
|
|
202
|
+
message: "请选择",
|
|
203
|
+
trigger: 'change'
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
options: [
|
|
207
|
+
{
|
|
208
|
+
value: '1',
|
|
209
|
+
label: '是',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
value: '0',
|
|
213
|
+
label: '否',
|
|
214
|
+
},
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
key: "pre_buffer_second",
|
|
220
|
+
label: "帧前缓存(秒)",
|
|
221
|
+
value: "",
|
|
222
|
+
component: ElInput,
|
|
223
|
+
params: {
|
|
224
|
+
"v-length.range": {
|
|
225
|
+
min: 0,
|
|
226
|
+
max: 1000,
|
|
227
|
+
int: true
|
|
228
|
+
},
|
|
229
|
+
rules: [
|
|
230
|
+
{
|
|
231
|
+
required: true,
|
|
232
|
+
message: "请输入",
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
[
|
|
239
|
+
{
|
|
240
|
+
key: "det_area_mode",
|
|
241
|
+
label: "检测区域工作模式",
|
|
242
|
+
value: 'normal',
|
|
243
|
+
component: ElRadioGroup,
|
|
244
|
+
events: {
|
|
245
|
+
change: detAreaModeChange
|
|
246
|
+
},
|
|
247
|
+
params: {
|
|
248
|
+
rules: [
|
|
249
|
+
{
|
|
250
|
+
required: true,
|
|
251
|
+
message: "请选择",
|
|
252
|
+
trigger: 'change'
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
options: [
|
|
256
|
+
{
|
|
257
|
+
value: 'normal',
|
|
258
|
+
label: '常规检测(normal)',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
value: 'abnormal',
|
|
262
|
+
label: '非常规检测(abnormal)',
|
|
263
|
+
},
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
],
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
function detAreaModeChange(value: any) {
|
|
272
|
+
if(value === 'abnormal') {
|
|
273
|
+
if(state.rows3?.length && state.rows3[state.rows3.length - 1]?.[0]?.key === 'det_area_json'){
|
|
274
|
+
state.rows3.pop()
|
|
159
275
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
276
|
+
state.rows3.push([{
|
|
277
|
+
key: "det_area_json",
|
|
278
|
+
label: "感兴趣区域",
|
|
279
|
+
value: '',
|
|
280
|
+
component: ElInput,
|
|
281
|
+
span: 6,
|
|
282
|
+
events: {
|
|
283
|
+
change: (value) => getAreasHandler(value),
|
|
284
|
+
},
|
|
285
|
+
params: {
|
|
286
|
+
rules: [
|
|
287
|
+
{
|
|
288
|
+
required: true,
|
|
289
|
+
message: "请输入",
|
|
290
|
+
trigger: 'change'
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
}, {value: ' '}])
|
|
295
|
+
}else {
|
|
296
|
+
state.rows3.pop()
|
|
172
297
|
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
reader.readAsText(file)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// 清除上传的文件
|
|
179
|
-
function clearFile() {
|
|
180
|
-
uploadedFile.value = null
|
|
181
|
-
formLoaded.value = false
|
|
182
|
-
showFormData.value = false
|
|
183
|
-
|
|
184
|
-
// 清空表单数据
|
|
185
|
-
Object.keys(formData).forEach(key => {
|
|
186
|
-
delete formData[key]
|
|
187
|
-
})
|
|
188
|
-
formItems.value = []
|
|
189
|
-
formRules.value = {}
|
|
190
|
-
Object.keys(optionsData).forEach(key => {
|
|
191
|
-
delete optionsData[key]
|
|
192
|
-
})
|
|
193
298
|
}
|
|
194
299
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
// 清空现有数据
|
|
198
|
-
Object.keys(formData).forEach(key => {
|
|
199
|
-
delete formData[key]
|
|
200
|
-
})
|
|
201
|
-
Object.keys(optionsData).forEach(key => {
|
|
202
|
-
delete optionsData[key]
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
// 设置新数据
|
|
206
|
-
if (config.formData) {
|
|
207
|
-
Object.assign(formData, config.formData)
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (config.formItems) {
|
|
211
|
-
formItems.value = config.formItems
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (config.formRules) {
|
|
215
|
-
formRules.value = config.formRules
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (config.optionsData) {
|
|
219
|
-
Object.assign(optionsData, config.optionsData)
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
formLoaded.value = true
|
|
223
|
-
|
|
224
|
-
// 在下一帧清除表单验证状态
|
|
225
|
-
nextTick(() => {
|
|
226
|
-
if (formRef.value) {
|
|
227
|
-
formRef.value.clearValidate()
|
|
228
|
-
}
|
|
229
|
-
})
|
|
300
|
+
function getAreasHandler(value: any) {
|
|
301
|
+
state.rows3[state.rows3.length - 1][0].value = value
|
|
230
302
|
}
|
|
231
303
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
304
|
+
/**
|
|
305
|
+
* 保存
|
|
306
|
+
*/
|
|
307
|
+
async function getFormData() {
|
|
308
|
+
try {
|
|
309
|
+
await formRef.value.validate();
|
|
310
|
+
} catch (error: any) {
|
|
311
|
+
console.log(error);
|
|
312
|
+
ElMessage.error('表单校验失败');
|
|
313
|
+
state.formData = {}
|
|
314
|
+
return false;
|
|
240
315
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
function resetForm() {
|
|
249
|
-
if (!formRef.value) return
|
|
250
|
-
formRef.value.resetFields()
|
|
251
|
-
ElMessage.info('表单已重置')
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// 切换表单数据显示
|
|
255
|
-
function toggleFormData() {
|
|
256
|
-
showFormData.value = !showFormData.value
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// 导出表单数据
|
|
260
|
-
function exportFormData() {
|
|
261
|
-
const dataStr = JSON.stringify(formData, null, 2)
|
|
262
|
-
const blob = new Blob([dataStr], { type: 'application/json' })
|
|
263
|
-
const url = URL.createObjectURL(blob)
|
|
264
|
-
const a = document.createElement('a')
|
|
265
|
-
a.href = url
|
|
266
|
-
a.download = 'form-data.json'
|
|
267
|
-
a.click()
|
|
268
|
-
URL.revokeObjectURL(url)
|
|
269
|
-
ElMessage.success('数据导出成功')
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// 复制表单数据
|
|
273
|
-
async function copyFormData() {
|
|
274
|
-
try {
|
|
275
|
-
await navigator.clipboard.writeText(JSON.stringify(formData, null, 2))
|
|
276
|
-
ElMessage.success('数据已复制到剪贴板')
|
|
277
|
-
} catch (error) {
|
|
278
|
-
ElMessage.error('复制失败')
|
|
279
|
-
console.error('复制失败:', error)
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// 表单事件处理
|
|
284
|
-
function handleValidate(valid: boolean, data: any) {
|
|
285
|
-
console.log('表单验证结果:', valid, data)
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function handleSubmit(data: any) {
|
|
289
|
-
console.log('表单提交:', data)
|
|
290
|
-
ElMessage.success('表单提交成功')
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
function handleReset(data: any) {
|
|
294
|
-
console.log('表单重置:', data)
|
|
316
|
+
const data1 = row1Ref.value?.getKeyValuePairs?.(state.rows);
|
|
317
|
+
const data2 = row2Ref.value?.getKeyValuePairs?.(state.rows2);
|
|
318
|
+
const data3 = row3Ref.value?.getKeyValuePairs?.(state.rows3);
|
|
319
|
+
const data = { ...data1, ...data2, ...data3 }
|
|
320
|
+
state.formData = data;
|
|
321
|
+
ElMessage.success('表单校验成功');
|
|
322
|
+
return data;
|
|
295
323
|
}
|
|
296
324
|
|
|
297
|
-
// 初始化时加载默认配置
|
|
298
|
-
nextTick(() => {
|
|
299
|
-
selectedConfig.value = 'ExampleFormConfig'
|
|
300
|
-
loadConfig()
|
|
301
|
-
})
|
|
302
325
|
</script>
|
|
303
326
|
|
|
304
|
-
<style
|
|
327
|
+
<style lang="scss" scoped>
|
|
305
328
|
.demo-container {
|
|
306
329
|
padding: 20px;
|
|
307
330
|
max-width: 1400px;
|
|
@@ -90,12 +90,12 @@
|
|
|
90
90
|
<span>当前: "{{ rangeInput4 }}%"</span>
|
|
91
91
|
</div>
|
|
92
92
|
|
|
93
|
-
<h3>整数范围模式 - v-length.range (
|
|
93
|
+
<h3>整数范围模式 - v-length.range (int)</h3>
|
|
94
94
|
<div class="input-group">
|
|
95
95
|
<label>整数范围 0-100 (仅整数):</label>
|
|
96
96
|
<el-input
|
|
97
97
|
v-model="rangeInput5"
|
|
98
|
-
v-length.range="{ min: 0, max: 100,
|
|
98
|
+
v-length.range="{ min: 0, max: 100, int: true }"
|
|
99
99
|
placeholder="仅能输入0-100之间的整数"
|
|
100
100
|
style="width: 300px;"
|
|
101
101
|
/>
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
<label>年龄范围 1-120 (仅整数):</label>
|
|
107
107
|
<el-input
|
|
108
108
|
v-model="rangeInput6"
|
|
109
|
-
v-length.range="{ min: 1, max: 120,
|
|
109
|
+
v-length.range="{ min: 1, max: 120, int: true, maxLength: 3 }"
|
|
110
110
|
placeholder="输入年龄1-120岁"
|
|
111
111
|
style="width: 300px;"
|
|
112
112
|
/>
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
<label>负整数范围 -10到10 (仅整数):</label>
|
|
118
118
|
<el-input
|
|
119
119
|
v-model="rangeInput7"
|
|
120
|
-
v-length.range="{ min: -10, max: 10,
|
|
120
|
+
v-length.range="{ min: -10, max: 10, int: true }"
|
|
121
121
|
placeholder="输入-10到10之间的整数"
|
|
122
122
|
style="width: 300px;"
|
|
123
123
|
/>
|