我正在尝试将 html 字符串呈现到基于 Azure 通信服务的聊天应用程序中。样板代码取自 Azure Samples GitHub 存储库https://github.com/Azure-Samples/communication-services-web-chat-hero。
我有格式的字符串:
"str1</br>str2</br>str3</br>"
.
我想要的是我想在应用程序的 ChatArea 组件中将此字符串呈现为 html,使其看起来像
str1
str2
str3
我还在 sideEffects.ts 文件的 sendMessageHelper 方法中将 SendMessageOptions.type 设置为“html”,但仍然仅将输出作为字符串获取。唯一的区别是现在我得到了没有/
标签的br
净化字符串。
任何帮助将不胜感激。提前非常感谢。