用vuejs对Form验证怎么进行对submit验证,验证失败不跳转,成功才跳转?我试了好几个方法都没实现,很郁闷,要么不验证,要么就是验证了不进行跳转。
如何用vuejs实现更好的Form validation? 好像还是vue-validator资料多些,接下来打算用这个了:https://github.com/vuejs/vue-validator vue用于表单验证目前有三个插件 举个例子吧,我用的的是vue-form
html: js: </div>
<div class="form-group">
@H_<a href="/tag/403/" target="_blank" class="keywords">403</a>_21@<a href="/tag/yonghuming/" target="_blank" class="keywords">用户名</a>*</label>
<input class="form-control" v-model="model.email" v-form-ctrl name="email" type="email" required />
</div>
<div class="errors" v-if="myform.$submitted">
<p class="bg-danger text-center" v-if="myform.name.$error.<a href="/tag/required/" target="_blank" class="keywords">required</a>">请输入<a href="/tag/yonghuming/" target="_blank" class="keywords">用户名</a>.</p>
<p class="bg-danger text-center" v-if="myform.email.$error.email">请输入正确的邮箱.</p>
</div>
<button class="btn btn-success btn-block" type="submit">提交</button>