Firestore 不保存文本区域的换行符 [英] Firestore does not save line breaks from text area
本文介绍了Firestore 不保存文本区域的换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用带有 Vue v-model 的文本区域并将其保存在 firestore 集合中.但是换行符在数据库中消失了.
如何修复?
<textarea v-model="docsInfo" rows="3"></textarea>//... JS导出默认{数据() {返回 {标题: "",文档信息:"",};},//...D b.collection("帖子").添加({标题:this.title,info: this.docsInfo//来自文本区域})
解决方案
换行符不会出现在 Firestore 控制台中,文本显示为一行,但它们会被保存.只需在下面的链接中应用标记的答案.Vue.js 显示空白(换行)
I am using a text area with Vue v-model and saving it in a firestore collection. But the line breaks disappear in database.
How can it be fixed ?
<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
})
解决方案
The line breaks don't appear in Firestore console and the text is shown as a single line, but they are saved. Just apply the marked answer in the link below. Vue.js show white space (line breaks)
这篇关于Firestore 不保存文本区域的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文