我遇到了一个问题,我在react应用程序中使用griddle.js和handsontable,并且我必须用sup标记显示值。但是输出的是带有//something<sup>somthing</sup>的平面文本,但是它应该像sup tag一样显示
我的意思是html标签被认为是平面文本。
任何建议都将不胜感激。对不起,我是Ractjs的初学者
const base_price = 100;
extProps.results = 'something' + base_price.sup(); //something + <sup>100</sup>
<Griddle
ref="griddle"
resultsPerPage={resultsPerPage}
table_value = { extProps.results}
/>发布于 2018-09-16 20:20:18
您可以使用dangerouslySetInnerHTML呈现html元素。
const base_price = 100;
extProps.results = <div dangerouslySetInnerHTML={{ __html: "something <sup>100</sup>" }} />;
<Griddle
ref="griddle"
resultsPerPage={resultsPerPage}
table_value = { extProps.results}
/>https://stackoverflow.com/questions/52353679
复制相似问题