繁体   English   中英

如何将 textarea 多行文本保存到 Cloud Firestore?

[英]How to save textarea multiline text to Cloud Firestore?

我有这个textArea输入字段,用于可能包含多行文本的blogPost文本内容,例如:

This is paragraph one.
(empty line)
This is paragraph two.

我将在带有white-space: pre-wrap;<p>标签内显示它(在我的应用程序中加载blogPosts时) white-space: pre-wrap;

我应该如何将其保存到 Cloud Firestore?

到目前为止我所得到的:

我正在考虑另存为JSON.stringify(textareaValue);

我怎样才能做到这一点? 还有更好的选择吗?

Cloud Firestore 将准确存储您发送的内容。 如果您在屏幕上渲染时需要字符串有所不同(例如将换行符转换为<br> ),那么您必须自己进行这些修改。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM