'v-model cannot be used on v-for
VueCompilerError: v-model cannot be used on v-for or v-slot scope variables because they are not writable. Why?
<template>
<div v-for="service in services" :key="service.id">
<ServicesItem v-model="service"></ServicesItem >
</div>
</template>
<script lang="ts">
import ServicesItem from "@js/components/ServicesItem.vue"
export default defineComponent({
components: { ServicesItem },
setup() {
const services = ref([
{
id: 1,
name: "Service 1",
active: false,
types_cars: {
cars: {},
suv: {},
},
},
])
return {
services,
}
},
})
</script>
What are the best practices? Reactive object transfers
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
