File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 90
90
"id" : 25
91
91
},
92
92
{
93
- "subject" : " dgdsfg " ,
93
+ "subject" : " 123123 " ,
94
94
"completed" : false ,
95
95
"body" : " dfghdfgh" ,
96
96
"id" : 26
97
+ },
98
+ {
99
+ "subject" : " " ,
100
+ "completed" : false ,
101
+ "body" : " " ,
102
+ "id" : 27
103
+ },
104
+ {
105
+ "subject" : " ab" ,
106
+ "completed" : false ,
107
+ "body" : " " ,
108
+ "id" : 28
97
109
}
98
110
]
99
111
}
Original file line number Diff line number Diff line change 15
15
type =" text"
16
16
class =" form-control"
17
17
>
18
+ <div
19
+ v-if =" subjectError"
20
+ style =" color : red "
21
+ >
22
+ {{subjectError}}
23
+ </div >
18
24
</div >
19
25
</div >
20
26
<div v-if =" editing" class =" col-6" >
@@ -87,6 +93,7 @@ export default {
87
93
completed: false ,
88
94
body: ' '
89
95
});
96
+ const subjectError = ref (' ' );
90
97
const originalTodo = ref (null );
91
98
const loading = ref (false );
92
99
const {
@@ -135,6 +142,12 @@ export default {
135
142
}
136
143
137
144
const onSave = async () => {
145
+ subjectError .value = ' ' ;
146
+ if (! todo .value .subject ) {
147
+ subjectError .value = ' Subject is required' ;
148
+ return ;
149
+ }
150
+
138
151
try {
139
152
let res;
140
153
const data = {
@@ -173,6 +186,7 @@ export default {
173
186
showToast,
174
187
toastMessage,
175
188
toastAlertType,
189
+ subjectError,
176
190
};
177
191
}
178
192
}
You can’t perform that action at this time.
0 commit comments