kazupon / vue-validator

:white_check_mark: Validator component for Vue.js
MIT License
2.19k stars 431 forks source link

this.$validate(true,...) won't add status to the 'select, checkbox, radio' #302

Open luxueyan opened 7 years ago

luxueyan commented 7 years ago

vue & vue-validator version

"vue": "^1.0.21","vue-validator": "^2.1.5",

Reproduction Link

none

Steps to reproduce

Manully do validatation! this.$validate(true, ....)

What is Expected?

All the form field will be add touched status

What is actually happening?

select & checkbox radio not to be touched

kazupon commented 7 years ago

Can you share the minimum reproduction code please?

luxueyan commented 7 years ago
              <!-- select类型 -->
                <div v-if="field.type === 'select'" v-cloak>
                  <select class="weui_select" v-model="filter[field.key]" @change="updateView(field.key)" :class="{'empty': !filter[field.key]}" :field="field.key" :name="field.key" v-validate="field.validate">
                    <option value="">请选择</option>
                    <option v-for="o in field.options" :value="o.value" v-cloak>{{o.value}}</option>
                  </select>
                </div>
    // model
     {
        name: '*评级情况',
        group: 'group2',
        key: 'rating_level',
        type: 'select',
        validate: {
          maxlength: 120,
          required: {
            rule: true,
            message: '请选择评级情况'
          }
        },
        options: [{
          key: '0',
          value: 'AA及以上'
        }, {
          key: '1',
          value: 'AA以下'
        }, {
          key: '2',
          value: '无'
        }]
      }
// .....
// methods
    onSubmit() {
      this.$validate(true, () => {
        // do something
      })
    }
kazupon commented 7 years ago

thanks! maybe, I'll confirm it and fixed later due to busy too. sorry...

luxueyan commented 7 years ago

Thanks for your fixed too!