Vue.js Array Input as Multiline Textarea

<template>  <b-form ref="form" @submit.prevent="submit">    <b-form-group      label="Name"      label-for="input-name"    >      <b-form-input        id="input-name"        v-model="item.name"      ></b-form-input>    </b-form-group>    <b-form-group      label="Alt Names"      label-for="input-alt-names"    >      <b-form-input        id="input-alt-names"        v-model="altNamesText"      ></b-form-input>    </b-form-group>  </b-form></template><script>export default {  props: ['item'],  computed: {    altNamesText: {      get() {        return this.item.alt_names?.join('\n')      },      set(newValue) {        this.item.alt_names = newValue.split('\n').map(e => e.trim()).filter(e => e != null && e !== '')         }    }  },  methods: {    submit() {      console.log(this.item.alt_names)    }  }}</script>

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.