首页 > 代码库 > vue form表单验证

vue form表单验证

 <el-select v-model="ruleForm.region" placeholder="请选择活动区域">
      <el-option label="区域一" value="http://www.mamicode.com/shanghai"></el-option>
      <el-option label="区域二" value="http://www.mamicode.com/beijing"></el-option>
 </el-select>

  

  ruleForm: {
          name: ‘‘,
          region: ‘‘,
          date1: ‘‘,
          date2: ‘‘,
          delivery: false,
          type: [],
          resource: ‘‘,
          desc: ‘‘
        },
        rules: {
          name: [
            { required: true, message: ‘请输入活动名称‘, trigger: ‘blur‘ },
            { min: 3, max: 5, message: ‘长度在 3 到 5 个字符‘, trigger: ‘blur‘ }
          ],
          region: [
            { required: true, message: ‘请选择活动区域‘, trigger: ‘change‘ }
          ],

  v-model="ruleForm.region"和prop="region"也必须保持一致

vue form表单验证