kadirklc
kadirklc

Reputation: 19

vuejs textarea 1 value per row

I have a problem

I want to get a value for each row value of posts in textarea

i am giving an example enter image description here

as in this image I want to have a value for each line written When I press the enter key and go to the bottom line and write there, I want to get the text written on that second line as a second value.

my goal is to be able to draw for each column

vuejs compisitions api or option api

Upvotes: 0

Views: 142

Answers (1)

alessandromanzini
alessandromanzini

Reputation: 141

Try this.

<script>
import { ref, computed } from 'vue'

export default {
    setup() {
        const textAreaText = ref('')

        const values = computed(() => textAreaText.value.split('\n'))

        return { textAreaText, values }
    }
}
</script>

<template>
    <textarea v-model="textAreaText"></textarea>

    <p>
        {{ values }}
    </p>
</template>

Upvotes: 1

Related Questions