我正在尝试在 jspdf 字符串上换行。问题是 firestore 不会将其(\n )识别为换行符,而是将其识别为字符串。
我尝试过的解决方案:
\n\n , html br 标签
var string = "This is a sample lb\n text"
var string1 = string.replace("lb","\n")
doc.text(10,10, string1)
actual : This is a sample lb\n text
expected : This is a sample
text
最佳答案
Cloud Firestore SDK 不存在换行问题,因此问题肯定出在代码中的其他位置。为了进行演示,我运行了以下代码,将字符串写入文档,检索它,然后显示结果:
代码:
db = firebase.firestore();
db.collection("lines").doc("newline").set({'myString': "This is a new\nline"});
x = db.collection("lines").doc("newline").get();
x.then(function(doc) {console.log(doc.data().myString)});
关于javascript - Firestore 无法读取\n jspdf 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55862073/