Answer the question
In order to leave comments, you need to log in
How to count the number of rows?
How to display number of lines in textarea?
<b-form-textarea
v-model="text"
id="mytextarea"
placeholder="Введите"
class="form-control form-control-lg"
rows="10"
>
</b-form-textarea>
Answer the question
In order to leave comments, you need to log in
computed: {
linesCount() {
return 1 + (this.text.match(/\n/g)?.length ?? 0);
},
},
<div>{{ linesCount }}</div>
el.value.split(/\r?\n|\r/).length
Create a div, insert a counter into the div, position it there by wrapping the field in another div, relative to which you position your counter div
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question