由于某种原因,我无法正确渲染嵌入在帖子中的reddit,当iframe生成时,高度被切断。如果我从开发人员工具中手动选择iframe,然后取消选中“高度:自动”,则其大小会正确调整。我不知道如何解决此问题或可能导致此问题的原因。任何帮助,将不胜感激。谢谢。
import React from 'react';
export default class RedditEmbedComponent extends React.Component {
componentWillMount() {
const script = document.createElement("script");
script.src = "//embed.redditmedia.com/widgets/platform.js";
script.async = true;
document.body.appendChild(script);
}
renderFrame = () => {
return (
<div>
<blockquote class="reddit-card" data-card-created="1553892582">
<a href="https://www.reddit.com/r/science/comments/b6wjlb/a_billion_people_may_be_newly_exposed_to_diseases/">
A billion people may be newly exposed to diseases like dengue fever as world temperature rises by the end of the century because of global
warming, says a new study that examines temperature changes on a monthly basis across the world.</a> from
<a href="http://www.reddit.com/r/science">r/science</a></blockquote>
</div>
);
}
render() {
return (<div>
{this.renderFrame()}
</div>);
}
}