I have a straightforward attendance application that is currently storing data in a SQL database. However, I am faced with the task of storing a computed property in the SQL database as well. Here is a snippet of the configuration:
<v-menu
v-model="start1"
:close-on-content-click="false"
:nudge-right="40"
transition="scale-transition"
offset-y
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
v-model="editedItem.start1"
prepend-icon="event"
readonly
label="Čas od *"
:rules="timeRules"
required
v-on="on"
></v-text-field>
</template>
<v-time-picker
format="24hr"
:max="editedItem.end1"
:allowed-minutes="allowedStep"
v-model="editedItem.start1"
@input="start1 = false"
></v-time-picker>
</v-menu>
</v-col>
editedItem: {
date: "",
start1: "",
end1: "",
start2: "00:00:00",
end2: "00:00:00",
start3: "00:00:00",
end3: "00:00:00",
totaltime: "",
km: "",
place: "",
note: ""
},
computed:
totaltime() {
return this.moment
.utc()
.startOf("day")
.add(this.computedTime66, "minutes")
.format("HH:mm");
},
Although using {{ totaltime }} displays the correct result on the website, I require it to be also stored in the SQL table under the totaltime field, similar to the other fields.