I have user data in DB. I want to set default check radio button with user data in database. Without v-model it works fine but if i put v-model on input, "checked" is not working. Anybody has suggestions?
My code is:
<template>
<div v-for="user in users">
<input v-model="theUser.role" type="radio" id="admin" value="admin" :checked="user.role === 'admin'">
<label for="admin">Admin</label><br>
<input v-model="theUser.role" type="radio" id="user" value="user" :checked="user.role === 'user'">
<label for="role">User</label>
</div>
</template>
export default {
data: () => ({
theUser: {
role: '',
active: '',
},
}),
};
theUser.role='admin'ortheUser.role='user'