Closed hasyrails closed 4 years ago
1つ目のステップの入力フォームでは名前(firstName, lastName)を入力、2つ目のステップの入力フォームではEmail、電話番号を入力、3つ目は誕生日を入力するシンプルなものです。4つ目では1〜3で入力した項目の値を一括表示させます。
Registerコンポーネント内に実装していく
data(){
return{
form: {
userName: null, // ユーザー名
email: null, // メールアドレス
password: null, // パスワード
passwordConfirmation: null // パスワード確認
}
}
// Register.vue
<button class="btn btn-primary" @click="backStep" >Back</button>
<button class="btn btn-primary" @click="nextStep" >Next</button>
methods:{
backStep:function(){
this.stepNumber--;
},
nextStep:function(){
this.stepNumber++;
},
}
STEP: 0, 4の時のボタン表示が不要
v-show
で STEP:0,4の時非表示に変更// Register.vue
<button class="btn btn-primary" @click="backStep" v-show="stepNumber != 1">Back</button>
<button class="btn btn-primary" @click="nextStep" v-show="stepNumber != 4">Next</button>
vue.jsでマルチステップの入力フォーム作成(基礎編)