Answer the question
In order to leave comments, you need to log in
How to get textarea value in Vue?
I have a textarea
component. This component I display on the
v-model page of the texarea gives an empty value and it does not change if I enter something into the textarea.
How can I get the value that I enter into the textarea?
card-textarea.vue:
<template>
<div class="textarea">
<textarea
name="card-textarea"
id=""
cols="30"
:rows="rows"
:placeholder="placeholder"
>
</textarea>
</div>
</template>
props: {
placeholder: {
type: String,
default: ""
},
rows: {
type: Number,
default: 5
},
}
<card-textarea
class="question-card"
:rows="questionCardRows"
v-model="questionText"
:placeholder="questionPlaceholderText"
>
</card-textarea>
data: () => ({
questionText: ""
}
methods: {
showText() {
this.questionText;
}
}
Answer the question
In order to leave comments, you need to log in
<template>
<div class="textarea">
<textarea
name="card-textarea"
id=""
cols="30"
:rows="rows"
:placeholder="placeholder"
:value="value"
@input="$emit('input', $event.target.value)"
>
</textarea>
</div>
</template>
props: {
placeholder: {
type: String,
default: ""
},
rows: {
type: Number,
default: 5
},
value: {
type: String
}
}
That's where you climb, at least once without reading the documentation to the end?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question