表单校验
模版中:
<template>
<!--
1:在data中用let定义规则
2:然后返回给return
3:然后在data中声明rules
4:保存时执行方法,this.$refs[newAddData].validate,实现参数校验
-->
<div>
<el-dialog title="新增" :visible="true" width="30%" center>
<!-- 注意:rules="rules"和ref="newAddData"和:model="newAddData" -->
<el-form
:inline="true"
:rules="rules"
:model="newAddData"
class="demo-form-inline"
ref="newAddData"
>
<el-form-item label="代理:" prop="agentId">
<!-- 远程搜索 -->
<el-select
v-model="newAddData.agentId"
multiple
filterable
remote
reserve-keyword
placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading"
>
<el-option v-for="(item,key) in options" :key="key" :value="item.id" :label="item.name"></el-option>
</el-select>
</el-form-item>
<el-form-item label="产品:" prop="checkList"&g