I am getting the following syntax error when I try to run a build on my Vue app.
error in ./src/pages/Calendar.vue?vue&type=script&lang=ts&
Syntax Error: 'return' outside of function. (175:4)
173 | getEventColor(event, Event);
174 | {
> 175 | return event.color;
| ^
176 | }
The component itself has the following code.
getEventColor (event: Event) {
return event.color
}
The code above does not have the syntax error getEventColor(event, Event);
so I am completely confused by the error saying that the return is 'outside' the function when it clearly isn't.
Also, the actual line the function is on is not 173 but 441. Line 173 is in the middle of my <template>
.
The component itself is a Veutify calendar. Here is the template that refers to the getEventColor
function.
<v-calendar
ref="calendar"
v-model="focus"
color="primary"
:events="events"
:event-color="getEventColor"
:now="today"
:type="type"
@click:event="showEvent"
@click:more="viewDay"
@click:date="viewDay"
@change="updateRange"
></v-calendar>
If anyone has any guidance on this issue I'd be very grateful.