表单验证 el-form-item里面验证两个el-select 必填如何验证
一、效果图
二 、主要代码
<el-form-item label="电路地址:" required>
<div style="display: flex; width: 400px">
<el-form-item
prop="electricAddressProvinceId"
:rules="[{ required: true, message: '请选择省专线选择', trigger: 'blur' }]"
>
<el-select
v-model="paltformFrom.electricAddressProvinceId"
size="small"
style="width: 200px"
filterable
clearable
:disabled="isEdit == 'detail'"
@change="changeProvince"
@clear="clearCity"
placeholder="省专线选择"
>
<el-option
v-for="item in provinceList"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
prop="electricAddressCityId"
:rules="[{ required: true, message: '请选择市专线选择', trigger: 'blur' }]"
>
<el-select
v-model="paltformFrom.electricAddressCityId"
size="small"
style="width: 200px"
filterable
clearable
:disabled="isEdit == 'detail'"
placeholder="市专线选择"
>
<el-option
v-for="item in cityList"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</div>
</el-form-item>
- 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
链接: http://t.zoukankan.com/cxxb-p-12881160.html