JellyBool 讲师
在使用 Laravel Vuejs 开发 SPA 应用的时候,我个人会推荐大家使用 vee-validate 表单验证组件进行表单验证,一是因为它的体验很棒,二是因为这个表单验证组件的用法跟后端 laravel 验证的写法极其相似。
此视频为收费视频,需登录后购买方可观看
JellyBool 讲师
在使用 Laravel Vuejs 开发 SPA 应用的时候,我个人会推荐大家使用 vee-validate 表单验证组件进行表单验证,一是因为它的体验很棒,二是因为这个表单验证组件的用法跟后端 laravel 验证的写法极其相似。
<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>
跟着视频来的 咋确认密码老是验证不过啊
<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">
. . . 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'}) }) }) } . . .
public function proxy($grantType, array $data = []) { $data = array_merge($data, [ 'client_id' => env('PASSPORT_CLIENT_ID'), 'client_secret' => env('PASSPORT_CLIENT_SECRET'), 'grant_type' => $grantType, ]); $response = $this->http->post//这步前端老是Provisional headers are shown Canceled有办法吗?('http://vue-spa.dev/oauth/token', [ 'form_params' => $data, ]);