I'm new to utilizing vuetify and I am curious if there is a method to set a value for a v-select using a function. My form can create an enterprise, leveraging apollo.js to connect with the database. Although all fields populate correctly when modifying an enterprise, I want the v-select to show the same value that the user previously selected. The code snippet for my v-select on the "modify" page:
<v-select
item-text="text"
item-value="value"
v-model="defaultSelected"
:items="qualifications"
menu-props="auto"
:rules="SelectRules"
></v-select>
The data :
export Default{
data: () => ({
defaultSelected{ value: "I need to implement a function here to establish a default value for the v-select" }
qualifications: [
{ text: "Blacklisted", value: "0"}
{ text: "Qualified", value: "1"}
{ text: "Non-qualified", value: "2"}
{ text: "High risk", value: "3"}
],
}),
I attempted this approach but it led to multiple errors:
export Default{
data: () => ({
defaultSelected{ value: renderQualificationValue }
qualifications: [
{ text: "Blacklisted", value: "0"}
{ text: "Qualified", value: "1"}
{ text: "Non-qualified", value: "2"}
{ text: "High risk", value: "3"}
],
}),
methods: {
renderQualificationValue(qualification)
if (qualification === 0) return "0";
else if (qualification === 1) return "1";
else if (qualification === 2) return "2";
else if (qualification === 3) return "3";
}
To clarify, I simply want to know if there exists a way to assign or define a value using a function.
Your assistance is greatly valued, thank you!