【问题标题】:Firestore does not save line breaks from text areaFirestore 不保存文本区域中的换行符
【发布时间】:2018-06-14 20:44:12
【问题描述】:

我正在使用带有 Vue v-model 的文本区域并将其保存在 firestore 集合中。但是换行符在数据库中消失了。

如何解决?

<div class="form-group">
    <textarea v-model="docsInfo" rows="3"></textarea>
</div>
// ... JS
export default {
    data() {
        return {
          title: "",
          docsInfo: "",
        };
    },
// ...
db
    .collection("posts")
    .add({
      title: this.title,
      info: this.docsInfo // from text area
    })

【问题讨论】:

    标签: firebase vue.js vuejs2 google-cloud-firestore


    【解决方案1】:

    换行符不会出现在 Firestore 控制台中,文本显示为单行,但它们会被保存。 只需在下面的链接中应用标记的答案。 Vue.js show white space (line breaks)

    【讨论】:

      猜你喜欢
      • 2016-07-15
      • 2023-03-14
      • 1970-01-01
      • 1970-01-01
      • 2023-01-24
      • 2012-09-02
      相关资源
      最近更新 更多