Rendering newline character in VueJS

前端 未结 6 1256
离开以前
离开以前 2020-12-24 00:06

I\'m creating a note app where users can add a note by entering multiline text in a textarea. When I save the note in Firebase it is being saved with newline (\\n) character

6条回答
  •  不知归路
    2020-12-24 00:46

    Convert \n to

    if (this.content.my_val && this.content.my_val !== '') {
        return this.content.my_val.replace(/\n/g, '
    ') }

提交回复
热议问题