登录后进行讨论

nfhh

nfhh 发表于 2019-07-19 14:05:33
<div class="form-group row">
    <label for="password" class="col-md-4 col-form-label text-md-right">密码</label>
    <div class="col-md-6">
        <input v-model="password"
               v-validate="{ rules:{ required:true,min:8 } }"
               :class="{'is-invalid':errors.has('password')}"
               id="password" type="password" class="form-control" name="password" required
               autocomplete="new-password">
        <div class="invalid-feedback" v-show="errors.has('password')">{{ errors.first('password') }}</div>
    </div>
</div>

<div class="form-group row">
    <label for="password-confirm" class="col-md-4 col-form-label text-md-right">确认密码</label>
    <div class="col-md-6">
        <input id="password-confirm"
               v-validate="{ rules:{ required:true,min:8,confirmed:'password' } }"
               :class="{'is-invalid':errors.has('password_confirmation')}"
               type="password" class="form-control" name="password_confirmation" required
               autocomplete="new-password">
        <div class="invalid-feedback" v-show="errors.has('password_confirmation')">{{ errors.first('password_confirmation') }}</div>
    </div>
</div>

跟着视频来的 咋确认密码老是验证不过啊

点赞 0

xudong0226

xudong0226 回复 nfhh 发表于 2019-08-23 13:45:49
<input id="password-confirm"
       :class="{ 'is-invalid' : errors.has('password_confirmation') }"
       v-validate="{required: true, min: 6, confirmed: password}"
       type="password" class="form-control" name="password_confirmation" autocomplete="new-password">
点赞 0

xudong0226

xudong0226 发表于 2019-08-23 14:14:11
.
.
.
    register(){
        let formData = {
            name : this.name,
            email: this.email,
            password: this.password
        }
    
        // Submit 验证
        this.$validator.validateAll().then(result=>{
            axios.post('/api/register',formData).then(response => {
                console.log('Register Successed!')
    
                this.$router.push({name:'confirm'})
            })
        })
    
    }
.
.
.
点赞 0