iview form verification problem Select has been selected or the verification prompt pops up

iview form verification problem Select has been selected or the verification prompt pops up

Problem: In the Select drop-down box of iview, data verification is required, and the data is clearly selected, but it keeps prompting that the verification cannot pass

<Form ref="ruleForm" :model="ruleForm" :rules="rules"  :label-width="120">
 	<Row :gutter="16">
          <Col span="12">
            <FormItem label="类型" prop="aType">
              <Select
                v-model="ruleForm['aType']"
                clearable
                placeholder="请选择类型">
                <Option
                  v-for="(item) in selectInfo['TypeSelect']"
                  :label="item.dicDisplay"
                  :value="item.dicValue"/>
              </Select>
            </FormItem>
          </Col>
      </Row>
</Form>

Check the iview document specification, and found that the default verification data type of iview is String, and the value used by my item.dicValue is a number type, so the type type is added for verification, and finally the verification code is written as the following to verify normally:

data(){
    
    
    return{
    
    
        rules:{
    
    
           aType: [
          {
    
     required: true, message: '输入不能为空', trigger: 'change',type:'number' }
        ], 
        }
    }
}

Guess you like

Origin blog.csdn.net/zzzz121380/article/details/125889614
Recommended