从 API post 方法获取 html 标签到数据中
Getting html tag into data from API post method
enter image description here
使用API post 方法将数据提取到模态中。将标签放入其中。
您可以使用某种解析器库,例如 https://www.npmjs.com/package/html-react-parser。
安装:npm i html-react-parser
const parse = require("html-react-parser");
function App() {
return (
<div className="App">
{parse(yourHtmlResponseString)}
</div>
);
}
重要:
Since adjacent elements are parsed as an array, make sure to render them under a parent node:
同时将要呈现的响应数据的默认值设置为字符串,以便解析器可以轻松处理它(如果您还没有这样做的话)。
enter image description here
使用API post 方法将数据提取到模态中。将标签放入其中。
您可以使用某种解析器库,例如 https://www.npmjs.com/package/html-react-parser。
安装:npm i html-react-parser
const parse = require("html-react-parser");
function App() {
return (
<div className="App">
{parse(yourHtmlResponseString)}
</div>
);
}
重要:
Since adjacent elements are parsed as an array, make sure to render them under a parent node:
同时将要呈现的响应数据的默认值设置为字符串,以便解析器可以轻松处理它(如果您还没有这样做的话)。