I am using a textarea field in a form and if I insert a value from the database into it (using laravel 10 and inertia) it is not displayed. However, it is displayed in any other place. It is obvious that the value conflicts with in the v-model
...
let form = reactive({
header: '',
});
...
...
{{ article.header }}
...
At the same time, I cannot set the default value in the vmodel like this
data() {
return {
form.header: article.header,
}
The syntax of form.header is incorrect, and article.header is not defined.
.
let form = reactive({
header: article.header,
});
article.header is not defined too
How could I pass the value of the variable to the texarea with v-model field
The on the text area v-model the form value, like v-model=form.header when you initialize the form header set the value to props.header...that's the general direction I've used in the past without issue.
Example with Inertia:
import { useForm } from "@inertiajs/vue3";
const props = defineProps({
header: String
});
const form = useForm({
header: props.header
});
/*in your text area add this v-model="form.header"*/
Then your initial variable is there but can also be edited and submitted in the form...