【发布时间】:2021-06-20 18:31:08
【问题描述】:
这可能是我的一个新手问题,但有人可以告诉我如何让 React 将输入文本显示为代码吗?
我正在编写一个文档,我想在其中添加一个 JSON 格式。但是,而不是这样:
{
"policies":{
"ExtensionSettings":{
"*":{
"blocked_install_message":"Custom error message.",
"install_sources":[
"about:addons",
"https://addons.mozilla.org/"
],
"installation_mode":"allowed",
"allowed_types":[
"extension"
]
},
"{d634138d-c276-4fc8-924b-40a0ea21d284}":{
"installation_mode":"force_installed",
"install_url":"https://addons.cdn.mozilla.net/user-media/addons/950528/1password_password_manager-1.23.1-fx.xpi?filehash=sha256%3A47e9e98f1072d93d595002dc8c221e5cca17e091b3431563a8e3e2be575c5cc1"
}
}
}
结果是这样的:
{ “策略”:{ “ExtensionSettings”:{ “*”:{ "blocked_install_message": "自定义错误信息。", "install_sources": ["about:addons","https://addons.mozilla.org/"],"installation_mode": “允许”,“允许类型”:[“扩展”]}, “{d634138d-c276-4fc8-924b-40a0ea21d284}”:{“安装模式”: “force_installed”、“install_url”: “https://addons.cdn.mozilla.net/user-media/addons/950528/1password_password_manager-1.23.1-fx.xpi?filehash=sha256%3A47e9e98f1072d93d595002dc8c221e5cca17e091b3431563a8e3e2be575c5cc1” } } }
我正在使用 React Semantic UI 并将文本包装在 <Container> 组件中。
【问题讨论】:
标签: html json reactjs text semantic-ui