0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

VeeValidate を使って、vue.jsで簡単にバリデート

Last updated at Posted at 2019-12-27

VeeValidate

フォームでのバリデーションで便利なVeeValidateというライブラリを使用。
yarnを使ってVeeValidateを導入

yarn add vee-validate

バリデートルールの指定

基本的に、inputタグの中に色々書き込むだけです。
**v-validate**の中にバリデートのルールを書き込みます。

ルール 意味
required 必須
max 最大文字数
numeric 半角数値のみ
email メールアドレス形式

v-validate = "required"と書き込むだけで、必須項目としてルールを追加できます。複数の条件を指定したい場合は|で区切ればOK!

参考

(VeeValidateはVue.js用の超便利なバリデーション)[https://www.kabanoki.net/4955/]

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?