[Vuejs]-How to save line breaks in database

0👍

To add linebreaks in mysql db ,You need to append /n whenever the user hits on enter key in the text box.I think this will help you

<template>
  <div id="app">
     <b-form-textarea 
       style="white-space: pre-line"
       v-model="projectShortDesc"
       class="mt-2 description-input"
        v-on:keyup.enter="onEnter">
      </b-form-textarea>
  </div>
</template>

<script>
export default {
 name: "App",
 methods: {
  onEnter() {
    this.projectShortDesc.apend('/n')
    },
 },
};
</script>

Leave a comment