I'm struggling to find out on how to render the selected values in Vue.
I have a form that runs a query based on the selection:
<form id="Register">
<br>Firstname<input type="checkbox" value="firstName">
<br>Lastname<input type="checkbox" value="lastName">
<br>Nickname<input type="checkbox" value="nickName">
<br>Mobile<input type="checkbox" value="Mobile"">
<br><button type="button" id="submit">Submit</button>
</form>
Then the queries return a JSON object like this:
data: {
names: [
{ firstName: "Jessica", lastName: "Jones" },
{ firstName: "Mike", lastName: "Lebowski" }
]
}
But when i try to render this in Vue using v-for
<div class v-for="name in names">
{{name}}
</div>
-or-
<div class v-for="name in names">
<div class v-for="details in name">
{{details}}
</div>
</div>
It renders either with the entire object
{ firstName: "Jessica", lastname: "Jones" }
or with firstname on one row and lastname on another.
Is there some way you can render everything in one row in the HTML based on the selected input?