[英]The line break doesn't work in the firestore
我使用 vue 3 和 Firestore。
當我寫的時候,即使我按回車鍵換行,它也只能寫空格。
在火庫
這是我的代碼。
<div class="form-group">
<textarea class="form-control" cols="30" rows="10" v-model="content" required></textarea>
</div>
await db.collection('forms').add(
{
title: title.value, content: content.value, createdAt, updatedAt, uid, name, views
}
)
如何使用換行符?
Firestore 中的換行符按書面形式保留,問題在於 Firestore 中的渲染機制被設計為忽略換行符以保留 Firestore 文檔的結構。
如果您下載文檔快照並在文本區域框中呈現文本,您可以看到這一點,對於網站,您可能必須用 web 安全替代品替換換行符,例如<br />
我剛剛添加了 style="white-space:pre-line" 並且它有效!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.