Upon attempting to run a build on my Vue app, I encountered the following syntax error.
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 corresponding code within the component is as follows.
getEventColor (event: Event) {
return event.color
}
The issue I'm facing is that even though the code snippet above does not contain the line getEventColor(event, Event);
, the error message claims that the return statement is located 'outside' of the function, which is confusing.
Furthermore, it mentions line 173 when in reality the function is on line 441. Line 173 actually falls within the <template>
section of my code.
This component is a Veutify calendar. Here's the template segment referencing 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 can provide insight or guidance on this matter, I would greatly appreciate it.