File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -217,23 +217,23 @@ async function handleSubmit(e: any) {
217
217
<SelectValue placeholder =" 选择你的社团" />
218
218
</SelectTrigger >
219
219
<SelectContent >
220
- <SelectGroup v-if =" clubs?.president.length" >
221
- <SelectItem v-for =" club in clubs.president" :key =" club.id" :value =" club.id" >
220
+ <SelectGroup v-if =" clubs?.president && clubs?.president .length" >
221
+ <SelectItem v-for =" club in clubs? .president" :key =" club.id" :value =" club.id" >
222
222
{{ club.name.zh }}
223
223
<span class =" inline-block text-gray-500" >
224
224
社长
225
225
</span >
226
226
</SelectItem >
227
227
</SelectGroup >
228
- <SelectGroup v-if =" clubs?.vice.length" >
228
+ <SelectGroup v-if =" clubs?.vice && clubs?.vice .length" >
229
229
<SelectItem v-for =" club in clubs?.vice" :key =" club.id" :value =" club.id" >
230
230
{{ club.name.zh }}
231
231
<span class =" inline-block text-gray-500" >
232
232
副社
233
233
</span >
234
234
</SelectItem >
235
235
</SelectGroup >
236
- <SelectGroup v-if =" clubs?.member.length" >
236
+ <SelectGroup v-if =" clubs?.member && clubs?.member .length" >
237
237
<SelectItem v-for =" club in clubs?.member" :key =" club.id" :value =" club.id" >
238
238
{{ club.name.zh }}
239
239
<span class =" inline-block text-gray-500" >
Original file line number Diff line number Diff line change @@ -7,14 +7,12 @@ const route = useRoute()
7
7
8
8
const isPresidentOrVicePresident = ref (false )
9
9
10
- const { data } = await useAsyncData <AllClubs >(' classroomStatuses' , () => {
11
- return $fetch <AllClubs >(` /api/user/all_clubs ` , {
12
- headers: useRequestHeaders (),
13
- method: ' GET' ,
14
- })
10
+ const { data } = await useFetch <AllClubs >(` /api/user/all_clubs ` , {
11
+ headers: useRequestHeaders (),
12
+ method: ' GET' ,
15
13
})
16
14
17
- if (data .value ?.president .length !== 0 || data .value ?.vice .length !== 0 ) {
15
+ if (data .value && ( data . value ?.president .length !== 0 || data .value ?.vice .length !== 0 ) ) {
18
16
isPresidentOrVicePresident .value = true
19
17
}
20
18
</script >
You can’t perform that action at this time.
0 commit comments