42
42
<input type =" text" name =" color" v-model =" form.color" />
43
43
</div >
44
44
<div class =" block" >
45
- <label class =" label" for =" weight" >Weight</label >
45
+ <label class =" label" for =" weight" >Weight (kg) </label >
46
46
<input type =" number" name =" weight" v-model =" form.weight" />
47
47
</div >
48
48
<div class =" block" >
53
53
<label class =" label" for =" birthday" >Birthday</label >
54
54
<input type =" date" name =" birthday" v-model =" form.birthday" />
55
55
</div >
56
+ <div class =" block" >
57
+ <label class =" label" for =" image" >Image url</label >
58
+ <input type =" text" name =" image" v-model =" form.image" />
59
+ </div >
56
60
<button type =" button" @click =" checkForm" class =" primary-btn" >Save</button >
57
61
</form >
58
62
</div >
@@ -80,13 +84,16 @@ export default {
80
84
? this .$store .state .currentPet .color
81
85
: " " ,
82
86
weight: this .$store .state .currentPet
83
- ? this .$store .state .currentPet .currentWeight
87
+ ? this .$store .state .currentPet .weight
84
88
: " " ,
85
89
chipNumber: this .$store .state .currentPet
86
90
? this .$store .state .currentPet .chipNumber
87
91
: " " ,
88
92
birthday: this .$store .state .currentPet
89
- ? this .$store .state .currentPet .birthDate
93
+ ? this .$store .state .currentPet .birthday
94
+ : " " ,
95
+ image: this .$store .state .currentPet
96
+ ? this .$store .state .currentPet .image
90
97
: " " ,
91
98
},
92
99
error: " " ,
@@ -96,8 +103,7 @@ export default {
96
103
checkForm () {
97
104
if (this .form .name ) {
98
105
this .error = " " ;
99
- // save form
100
- console .log (this .form );
106
+ this .$store .dispatch (" savePet" , this .form );
101
107
this .$router .push ({ name: " choose-pet" });
102
108
} else {
103
109
this .error = " Name is required." ;
@@ -127,17 +133,6 @@ export default {
127
133
inline-size : 100% ;
128
134
text-align : left ;
129
135
}
130
- input ,
131
- select {
132
- border : 1px solid #ff738c ;
133
- border-radius : 4px ;
134
- padding : 5px ;
135
- box-sizing : border-box ;
136
-
137
- &:focus-visible {
138
- outline: 2px solid #ff738c ;
139
- }
140
- }
141
136
.primary-btn {
142
137
inline-size : 100% ;
143
138
}
0 commit comments