LoginSignup
2
0

More than 3 years have passed since last update.

[Vue.js]vee-validateで連番で回ってる要素に対してバリデーションをつける

Last updated at Posted at 2019-06-04

やりたいこと

配列を回すごとに生成される(input要素のコンポーネントだとお思いください)に対して、都度バリデーションを貼りたい

やったこと


<template v-for="(value, index) Ary">
              <base-input
                :key="index"
                v-model="Ary[index].name"
                v-validate="'required|email'"
                :name="'name' + index"
                :class="{ 'has-error': errors.has('name' + index) }"
                data-vv-as="タイトル"
              />
              <p v-if="errors.has('name' + index)" class="alert-danger">
                {{ errors.first('name' + index) }}
              </p>
</template>

2
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
2
0